* [PATCH 0/3] md: remove redundant __GFP_NOWARN
@ 2025-08-11 12:36 Qianfeng Rong
2025-08-11 12:36 ` [PATCH 2/3] dm bufio: " Qianfeng Rong
0 siblings, 1 reply; 6+ messages in thread
From: Qianfeng Rong @ 2025-08-11 12:36 UTC (permalink / raw)
To: Coly Li, Kent Overstreet, Alasdair Kergon, Mike Snitzer,
Mikulas Patocka, Song Liu, Yu Kuai,
open list:BCACHE (BLOCK LAYER CACHE), open list,
open list:DEVICE-MAPPER (LVM),
open list:SOFTWARE RAID (Multiple Disks) SUPPORT
Cc: Qianfeng Rong
Commit 16f5dfbc851b ("gfp: include __GFP_NOWARN in GFP_NOWAIT") made
GFP_NOWAIT implicitly include __GFP_NOWARN.
Therefore, explicit __GFP_NOWARN combined with GFP_NOWAIT (e.g.,
`GFP_NOWAIT | __GFP_NOWARN`) is now redundant. Let's clean up these
redundant flags across subsystems.
No functional changes.
Qianfeng Rong (3):
bcache: remove redundant __GFP_NOWARN
dm bufio: remove redundant __GFP_NOWARN
md/raid5: remove redundant __GFP_NOWARN
drivers/md/bcache/btree.c | 2 +-
drivers/md/dm-bufio.c | 10 +++++-----
drivers/md/raid5-cache.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] dm bufio: remove redundant __GFP_NOWARN
2025-08-11 12:36 [PATCH 0/3] md: remove redundant __GFP_NOWARN Qianfeng Rong
@ 2025-08-11 12:36 ` Qianfeng Rong
2025-08-11 12:44 ` Mikulas Patocka
0 siblings, 1 reply; 6+ messages in thread
From: Qianfeng Rong @ 2025-08-11 12:36 UTC (permalink / raw)
To: Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
open list:DEVICE-MAPPER (LVM), open list
Cc: Qianfeng Rong
GFP_NOWAIT already includes __GFP_NOWARN, so let's remove the redundant
__GFP_NOWARN. Also update comments to clarify the flag semantics.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/md/dm-bufio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index ff7595caf440..4b20854e92f5 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1337,7 +1337,7 @@ static void use_bio(struct dm_buffer *b, enum req_op op, sector_t sector,
char *ptr;
unsigned int len;
- bio = bio_kmalloc(1, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOWARN);
+ bio = bio_kmalloc(1, GFP_NOWAIT | __GFP_NORETRY);
if (!bio) {
use_dmio(b, op, sector, n_sectors, offset, ioprio);
return;
@@ -1601,18 +1601,18 @@ static struct dm_buffer *__alloc_buffer_wait_no_callback(struct dm_bufio_client
* dm-bufio is resistant to allocation failures (it just keeps
* one buffer reserved in cases all the allocations fail).
* So set flags to not try too hard:
- * GFP_NOWAIT: don't wait; if we need to sleep we'll release our
- * mutex and wait ourselves.
+ * GFP_NOWAIT: don't wait and don't print a warning in case of
+ * failure; if we need to sleep we'll release our mutex
+ * and wait ourselves.
* __GFP_NORETRY: don't retry and rather return failure
* __GFP_NOMEMALLOC: don't use emergency reserves
- * __GFP_NOWARN: don't print a warning in case of failure
*
* For debugging, if we set the cache size to 1, no new buffers will
* be allocated.
*/
while (1) {
if (dm_bufio_cache_size_latch != 1) {
- b = alloc_buffer(c, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
+ b = alloc_buffer(c, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOMEMALLOC);
if (b)
return b;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] dm bufio: remove redundant __GFP_NOWARN
2025-08-11 12:36 ` [PATCH 2/3] dm bufio: " Qianfeng Rong
@ 2025-08-11 12:44 ` Mikulas Patocka
2025-08-11 12:58 ` Qianfeng Rong
0 siblings, 1 reply; 6+ messages in thread
From: Mikulas Patocka @ 2025-08-11 12:44 UTC (permalink / raw)
To: Qianfeng Rong
Cc: Alasdair Kergon, Mike Snitzer, open list:DEVICE-MAPPER (LVM),
open list
Hi
I think that GFP_NOWAIT already includes __GFP_NORETRY too. So, should we
drop __GFP_NORETRY as well?
Mikulas
On Mon, 11 Aug 2025, Qianfeng Rong wrote:
> GFP_NOWAIT already includes __GFP_NOWARN, so let's remove the redundant
> __GFP_NOWARN. Also update comments to clarify the flag semantics.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> drivers/md/dm-bufio.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> index ff7595caf440..4b20854e92f5 100644
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
> @@ -1337,7 +1337,7 @@ static void use_bio(struct dm_buffer *b, enum req_op op, sector_t sector,
> char *ptr;
> unsigned int len;
>
> - bio = bio_kmalloc(1, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOWARN);
> + bio = bio_kmalloc(1, GFP_NOWAIT | __GFP_NORETRY);
> if (!bio) {
> use_dmio(b, op, sector, n_sectors, offset, ioprio);
> return;
> @@ -1601,18 +1601,18 @@ static struct dm_buffer *__alloc_buffer_wait_no_callback(struct dm_bufio_client
> * dm-bufio is resistant to allocation failures (it just keeps
> * one buffer reserved in cases all the allocations fail).
> * So set flags to not try too hard:
> - * GFP_NOWAIT: don't wait; if we need to sleep we'll release our
> - * mutex and wait ourselves.
> + * GFP_NOWAIT: don't wait and don't print a warning in case of
> + * failure; if we need to sleep we'll release our mutex
> + * and wait ourselves.
> * __GFP_NORETRY: don't retry and rather return failure
> * __GFP_NOMEMALLOC: don't use emergency reserves
> - * __GFP_NOWARN: don't print a warning in case of failure
> *
> * For debugging, if we set the cache size to 1, no new buffers will
> * be allocated.
> */
> while (1) {
> if (dm_bufio_cache_size_latch != 1) {
> - b = alloc_buffer(c, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
> + b = alloc_buffer(c, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOMEMALLOC);
> if (b)
> return b;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] dm bufio: remove redundant __GFP_NOWARN
2025-08-11 12:44 ` Mikulas Patocka
@ 2025-08-11 12:58 ` Qianfeng Rong
2025-08-11 15:10 ` Mikulas Patocka
0 siblings, 1 reply; 6+ messages in thread
From: Qianfeng Rong @ 2025-08-11 12:58 UTC (permalink / raw)
To: Mikulas Patocka
Cc: Alasdair Kergon, Mike Snitzer, open list:DEVICE-MAPPER (LVM),
open list
在 2025/8/11 20:44, Mikulas Patocka 写道:
> Hi
>
> I think that GFP_NOWAIT already includes __GFP_NORETRY too. So, should we
> drop __GFP_NORETRY as well?
GFP_NOWAIT does not include __GFP_NORETRY:
#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM | __GFP_NOWARN)
GFP_NOWAIT tells the memory manager to only wake up kswapd to perform
memory reclamation, not to perform direct memory reclaim. Even if the
request fails, no error message is printed.
Best regards,
Qianfeng
>
> Mikulas
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] dm bufio: remove redundant __GFP_NOWARN
2025-08-11 12:58 ` Qianfeng Rong
@ 2025-08-11 15:10 ` Mikulas Patocka
2025-08-12 2:18 ` Qianfeng Rong
0 siblings, 1 reply; 6+ messages in thread
From: Mikulas Patocka @ 2025-08-11 15:10 UTC (permalink / raw)
To: Qianfeng Rong
Cc: Alasdair Kergon, Mike Snitzer, open list:DEVICE-MAPPER (LVM),
open list
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
On Mon, 11 Aug 2025, Qianfeng Rong wrote:
>
> 在 2025/8/11 20:44, Mikulas Patocka 写道:
> > Hi
> >
> > I think that GFP_NOWAIT already includes __GFP_NORETRY too. So, should we
> > drop __GFP_NORETRY as well?
>
> GFP_NOWAIT does not include __GFP_NORETRY:
> #define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM | __GFP_NOWARN)
>
> GFP_NOWAIT tells the memory manager to only wake up kswapd to perform
> memory reclamation, not to perform direct memory reclaim. Even if the
> request fails, no error message is printed.
>
> Best regards,
> Qianfeng
Yes, but if GFP_NOWAIT allocation can't sleep, it can't retry - thus
GFP_NOWAIT should imply __GFP_NORETRY.
Mikulas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] dm bufio: remove redundant __GFP_NOWARN
2025-08-11 15:10 ` Mikulas Patocka
@ 2025-08-12 2:18 ` Qianfeng Rong
0 siblings, 0 replies; 6+ messages in thread
From: Qianfeng Rong @ 2025-08-12 2:18 UTC (permalink / raw)
To: Mikulas Patocka
Cc: Alasdair Kergon, Mike Snitzer, open list:DEVICE-MAPPER (LVM),
open list
在 2025/8/11 23:10, Mikulas Patocka 写道:
>
> On Mon, 11 Aug 2025, Qianfeng Rong wrote:
>
>> 在 2025/8/11 20:44, Mikulas Patocka 写道:
>>> Hi
>>>
>>> I think that GFP_NOWAIT already includes __GFP_NORETRY too. So, should we
>>> drop __GFP_NORETRY as well?
>> GFP_NOWAIT does not include __GFP_NORETRY:
>> #define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM | __GFP_NOWARN)
>>
>> GFP_NOWAIT tells the memory manager to only wake up kswapd to perform
>> memory reclamation, not to perform direct memory reclaim. Even if the
>> request fails, no error message is printed.
>>
>> Best regards,
>> Qianfeng
> Yes, but if GFP_NOWAIT allocation can't sleep, it can't retry - thus
> GFP_NOWAIT should imply __GFP_NORETRY.
>
> Mikulas
I strongly agree with your perspective, but I'm uncertain whether
GFP_NOWAIT should include __GFP_NORETRY, or if we should add a
note stating GFP_NOWAIT/GFP_ATOMIC should not be combined with
__GFP_NORETRY since it becomes redundant in atomic contexts. I'll
raise this issue to see if others have insights.
Best regards,
Qianfeng
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-12 2:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 12:36 [PATCH 0/3] md: remove redundant __GFP_NOWARN Qianfeng Rong
2025-08-11 12:36 ` [PATCH 2/3] dm bufio: " Qianfeng Rong
2025-08-11 12:44 ` Mikulas Patocka
2025-08-11 12:58 ` Qianfeng Rong
2025-08-11 15:10 ` Mikulas Patocka
2025-08-12 2:18 ` Qianfeng Rong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).