Message ID | 20220426174335.4004987-3-shr@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | io-uring/xfs: support async buffered writes | expand |
On Tue, Apr 26, 2022 at 10:43:19AM -0700, Stefan Roesch wrote: > Define FGP_ATOMIC flag and add support for the new flag in the function > __filemap_get_folio(). No. You don't get to use the emergency memory pools for doing writes. That completely screws up the MM.
On 4/26/22 12:06 PM, Matthew Wilcox wrote: > On Tue, Apr 26, 2022 at 10:43:19AM -0700, Stefan Roesch wrote: >> Define FGP_ATOMIC flag and add support for the new flag in the function >> __filemap_get_folio(). > > No. You don't get to use the emergency memory pools for doing writes. > That completely screws up the MM. The next version of the patch will remove this patch from the patch series and the need of the atomic flag.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 993994cd943a..b8d839e10780 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -509,6 +509,7 @@ pgoff_t page_cache_prev_miss(struct address_space *mapping, #define FGP_HEAD 0x00000080 #define FGP_ENTRY 0x00000100 #define FGP_STABLE 0x00000200 +#define FGP_ATOMIC 0x00000400 struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, int fgp_flags, gfp_t gfp); diff --git a/mm/filemap.c b/mm/filemap.c index 9a1eef6c5d35..dd3c5682276e 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1929,6 +1929,7 @@ static void *mapping_get_entry(struct address_space *mapping, pgoff_t index) * * %FGP_NOFS - __GFP_FS will get cleared in gfp. * * %FGP_NOWAIT - Don't get blocked by page lock. * * %FGP_STABLE - Wait for the folio to be stable (finished writeback) + * * %FGP_ATOMIC - Use atomic allocations * * If %FGP_LOCK or %FGP_CREAT are specified then the function may sleep even * if the %GFP flags specified for %FGP_CREAT are atomic. @@ -1988,6 +1989,8 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, gfp |= __GFP_WRITE; if (fgp_flags & FGP_NOFS) gfp &= ~__GFP_FS; + if (fgp_flags & FGP_ATOMIC) + gfp |= GFP_ATOMIC; folio = filemap_alloc_folio(gfp, 0); if (!folio)
Define FGP_ATOMIC flag and add support for the new flag in the function __filemap_get_folio(). Signed-off-by: Stefan Roesch <shr@fb.com> --- include/linux/pagemap.h | 1 + mm/filemap.c | 3 +++ 2 files changed, 4 insertions(+)