lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070423142919.5809e03f.akpm@linux-foundation.org>
Date:	Mon, 23 Apr 2007 14:29:19 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Christoph Lameter <clameter@....com>
Cc:	Nick Piggin <npiggin@...e.de>, linux-kernel@...r.kernel.org,
	pj@....com, Hugh Dickins <hugh@...itas.com>
Subject: Re: Pagecache: find_or_create_page does not call a proper page
 allocator function

On Mon, 23 Apr 2007 14:11:57 -0700 (PDT)
Christoph Lameter <clameter@....com> wrote:

> The find_or_create function calls alloc_page with a local gfp mask instead
> of using page_cache_alloc. This means that the page allocation will not
> obey cpuset memory spreading and page allocation will not properly use the
> gfp flags in the address space. Highmem is not set correctly.
> 
> It turns out that there is no function to allocate a page for the page cache
> with a gfp mask. So we create one ORing the context gfp flags with the gfp flags
> from the mapping.
> 
> Signed-off-by: Christoph Lameter <clameter@....com>
> 
> ---
>  include/linux/pagemap.h |   10 ++++++++--
>  mm/filemap.c            |    3 ++-
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.21-rc7/include/linux/pagemap.h
> ===================================================================
> --- linux-2.6.21-rc7.orig/include/linux/pagemap.h	2007-04-23 13:52:20.000000000 -0700
> +++ linux-2.6.21-rc7/include/linux/pagemap.h	2007-04-23 14:01:09.000000000 -0700
> @@ -60,14 +60,20 @@ static inline struct page *__page_cache_
>  }
>  #endif
>  
> +static inline struct page *page_cache_alloc_mask(struct address_space *x,
> +			gfp_t gfp)
> +{
> +	return __page_cache_alloc(mapping_gfp_mask(x) | gfp);
> +}

Usually we use the term "mask" to imply an AND function, not an OR
function.

There are few calls to page_cache_alloc().  Would it not be simpler to just
add the additional argument to page_cache_alloc() (called "extra_gfp",
please) and to update all callers?  And to remove page_cache_alloc_cold()
and replace all it callers with page_cache_alloc(mapping, __GFP_COLD)?

The way we actually get rid of an API call instead of adding another one.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ