From: Ming Lei <ming.lei@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <snitzer@kernel.org>,
dm-devel@lists.linux.dev, ming.lei@redhat.com
Subject: Re: Useless test in alloc_multiple_bios
Date: Thu, 16 May 2024 17:19:41 +0800 [thread overview]
Message-ID: <ZkXPrY+pWG0cHPAB@fedora> (raw)
In-Reply-To: <ec2ba8a0-5a8-6dd0-eb56-33c8e7a389ea@redhat.com>
On Wed, May 15, 2024 at 08:15:20PM +0200, Mikulas Patocka wrote:
> Hi
>
> I found this piece of code in alloc_multiple_bios:
> int try = (gfp_flag & GFP_NOWAIT) ? 0 : 1;
I guess the above check is supposed to be (gfp_flag == GFP_NOWAIT)?
>
> The problem is that GFP_NOWAIT includes __GFP_KSWAPD_RECLAIM and GFP_IO
> also includes __GFP_KSWAPD_RECLAIM - so the test always returns true and
> we always start with try = 0. This code was introduced by the commit
> 4a2fe2960891f1ccd7805d0973284fd44c2f12b4.
>
> I am inclined to remove this logic at all and always start with try = 0;
> - trying to allocate bios first with GFP_NOWAIT makes no harm (and it
> improves performance because we don't need to grab the lock) and if the
> allocation fails, it is retried with GFP_NOIO.
I think it is fine to simplify the logic in this way, and now GFP_NOWAIT is
only for sending empty flush, which could be from fast path, and abnormal IO
is supposed to be in slow path.
Thanks,
Ming
prev parent reply other threads:[~2024-05-16 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 18:15 Useless test in alloc_multiple_bios Mikulas Patocka
2024-05-16 9:19 ` Ming Lei [this message]
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 \
--in-reply-to=ZkXPrY+pWG0cHPAB@fedora \
--to=ming.lei@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.