Re: [PATCH] mm: get rid of radix tree gfp mask for pagecache_get_page (was: Re: How to handle TIF_MEMDIE stalls?)

Linus Torvalds
2014-12-29T18:45:24Z

So I think this patch is definitely going in the right direction, but
at least the __GFP_WRITE handling is insane:

(Patch edited to show the resulting code, without the old deleted lines)

On Mon, Dec 29, 2014 at 9:40 AM, Michal Hocko <mhocko@suse.cz> wrote:
> @@ -1105,13 +1102,11 @@ no_page:
> if (!page && (fgp_flags & FGP_CREAT)) {
> int err;
> if ((fgp_flags & FGP_WRITE) && mapping_cap_account_dirty(mapping))
> + gfp_mask |= __GFP_WRITE;
> + if (fgp_flags & FGP_NOFS)
> + gfp_mask &= ~__GFP_FS;
>
> + page = __page_cache_alloc(gfp_mask);
> if (!page)
> return NULL;
>
> @@ -1122,7 +1117,7 @@ no_page:
> if (fgp_flags & FGP_ACCESSED)
> __SetPageReferenced(page);
>
> + err = add_to_page_cache_lru(page, mapping, offset, gfp_mask);

Passing __GFP_WRITE into the radix tree allocation routines is not
sane. So you'd have to mask the bit out again here (unconditionally is
fine).

But other than that this seems to be a sane cleanup.

Linus