linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm: Add readahead support for IOCB_NOWAIT
@ 2024-08-12  9:05 Yafang Shao
  2024-08-12  9:05 ` [PATCH 1/2] mm: Add memalloc_nowait_{save,restore} Yafang Shao
  2024-08-12  9:05 ` [PATCH 2/2] mm: allow read-ahead with IOCB_NOWAIT set Yafang Shao
  0 siblings, 2 replies; 37+ messages in thread
From: Yafang Shao @ 2024-08-12  9:05 UTC (permalink / raw)
  To: akpm, viro, brauner, jack, david; +Cc: linux-fsdevel, linux-mm, Yafang Shao

We have use cases where we want to trigger readahead in preadv2(2) with
RWF_NOWAIT set [0].

Readahead support was originally added for IOCB_NOWAIT in commit
2e85abf053b9 ("mm: allow read-ahead with IOCB_NOWAIT set"). However, this
behavior was modified in commit efa8480a8316 ("fs: RWF_NOWAIT should imply
IOCB_NOIO") due to concerns about potential blocking during memory
reclamation.

To prevent blocking on memory reclamation, we can utilize
memalloc_nowait_{save,restore} to ensure non-blocking behavior. By
restoring the original behavior, we can allow preadv2(IOCB_NOWAIT) to read
data directly from disk if it's not already in the page cache.

Changes:
- fs: Add a new flag RWF_IOWAIT for preadv2(2)
  https://lore.kernel.org/linux-fsdevel/20240804080251.21239-1-laoar.shao@gmail.com/ [0]

Yafang Shao (2):
  mm: Add memalloc_nowait_{save,restore}
  mm: allow read-ahead with IOCB_NOWAIT set

 include/linux/fs.h       |  1 -
 include/linux/sched/mm.h | 30 ++++++++++++++++++++++++++++++
 mm/filemap.c             |  6 ++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

-- 
2.43.5



^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2024-09-01 20:42 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-12  9:05 [PATCH 0/2] mm: Add readahead support for IOCB_NOWAIT Yafang Shao
2024-08-12  9:05 ` [PATCH 1/2] mm: Add memalloc_nowait_{save,restore} Yafang Shao
2024-08-12 11:37   ` Christoph Hellwig
2024-08-12 12:59     ` Yafang Shao
2024-08-12 13:21       ` Christoph Hellwig
2024-08-13  2:09         ` Yafang Shao
2024-08-14  5:27           ` Christoph Hellwig
2024-08-14  7:33             ` Yafang Shao
2024-09-01 20:24               ` Vlastimil Babka
2024-09-01 20:42                 ` Kent Overstreet
2024-08-14  7:42       ` Michal Hocko
2024-08-14  8:12         ` Yafang Shao
2024-08-14 12:43           ` Michal Hocko
2024-08-15  3:26             ` Yafang Shao
2024-08-15  6:22               ` Michal Hocko
2024-08-15  6:32                 ` Yafang Shao
2024-08-15  6:51                   ` Michal Hocko
2024-08-16  8:17                     ` [PATCH] mm: document risk of PF_MEMALLOC_NORECLAIM Michal Hocko
2024-08-16  8:22                       ` Christoph Hellwig
2024-08-16  8:54                         ` Michal Hocko
2024-08-16 14:26                           ` Christoph Hellwig
2024-08-16 15:57                             ` Michal Hocko
2024-08-21  7:30                           ` Michal Hocko
2024-08-21 11:44                           ` Christoph Hellwig
2024-08-21 12:37                             ` Michal Hocko
2024-08-22  9:09                               ` Christian Brauner
2024-08-17  2:29                       ` Yafang Shao
2024-08-19  7:57                         ` Michal Hocko
2024-08-12 16:48     ` [PATCH 1/2] mm: Add memalloc_nowait_{save,restore} Kent Overstreet
2024-08-14  5:24       ` Christoph Hellwig
2024-08-14  0:28   ` Dave Chinner
2024-08-14  2:19     ` Yafang Shao
2024-08-14  5:42       ` Dave Chinner
2024-08-14  7:32         ` Yafang Shao
2024-08-15  2:54           ` Dave Chinner
2024-08-15  3:38             ` Yafang Shao
2024-08-12  9:05 ` [PATCH 2/2] mm: allow read-ahead with IOCB_NOWAIT set Yafang Shao

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).