From: Jens Axboe <[email protected]>
To: Pavel Begunkov <[email protected]>,
Hao Xu <[email protected]>
Cc: [email protected], Joseph Qi <[email protected]>
Subject: Re: [PATCH] io-wq: simplify code in __io_worker_busy
Date: Sun, 4 Apr 2021 13:17:17 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 4/2/21 4:38 AM, Pavel Begunkov wrote:
> On 02/04/2021 11:18, Hao Xu wrote:
>> leverage xor to simplify code in __io_worker_busy
>
> I don't like hard-coded ^1 because if indexes change it may break.
> One option is to leave it to the compiler:
>
> idx = bound : WQ_BOUND ? WQ_UNBOUND;
> compl_idx = bound : WQ_UNBOUND ? WQ_BOUND;
>
> Or add a BUILD_BUG_ON() checking that WQ_BOUND and WQ_UNBOUND
> are mod 2 complementary.
Was going to suggest just that, just add a BUILD_BUG_ON() to catch
any changes there. The code is way cleaner with the XOR trick.
Hao, can you resend with that?
--
Jens Axboe
next prev parent reply other threads:[~2021-04-04 19:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 10:18 [PATCH] io-wq: simplify code in __io_worker_busy Hao Xu
2021-04-02 10:38 ` Pavel Begunkov
2021-04-04 19:17 ` Jens Axboe [this message]
2021-04-05 7:53 ` [PATCH v3] " Hao Xu
2021-04-05 21:46 ` Jens Axboe
2021-04-06 2:18 ` Hao Xu
2021-04-06 3:08 ` [PATCH v4] " Hao Xu
2021-04-06 15:36 ` Jens Axboe
2021-04-07 18:28 ` Pavel Begunkov
2021-04-05 7:36 ` [PATCH v2] " Hao Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox