linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Christoph Lameter <clameter@sgi.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	Nick Piggin <npiggin@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: [patch 1/5] slub: Determine gfpflags once and not every time a slab is allocated
Date: Thu, 14 Feb 2008 13:55:48 +0000	[thread overview]
Message-ID: <20080214135548.GD17641@csn.ul.ie> (raw)
In-Reply-To: <20080214040313.318658830@sgi.com>

On (13/02/08 20:02), Christoph Lameter didst pronounce:
> Currently we determine the gfp flags to pass to the page allocator
> each time a slab is being allocated.
> 
> Determine the bits to be set at the time the slab is created. Store
> in a new allocflags field and add the flags in allocate_slab().
> 
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> 
> ---
>  include/linux/slub_def.h |    1 +
>  mm/slub.c                |   19 +++++++++++--------
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6/include/linux/slub_def.h
> ===================================================================
> --- linux-2.6.orig/include/linux/slub_def.h	2008-02-13 17:13:49.378744786 -0800
> +++ linux-2.6/include/linux/slub_def.h	2008-02-13 18:50:42.235907853 -0800
> @@ -71,6 +71,7 @@ struct kmem_cache {
>  
>  	/* Allocation and freeing of slabs */
>  	int objects;		/* Number of objects in slab */
> +	gfp_t allocflags;	/* gfp flags to use on each alloc */
>  	int refcount;		/* Refcount for slab cache destroy */
>  	void (*ctor)(struct kmem_cache *, void *);
>  	int inuse;		/* Offset to metadata */
> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c	2008-02-13 17:13:49.386744784 -0800
> +++ linux-2.6/mm/slub.c	2008-02-13 18:53:49.612240235 -0800
> @@ -1078,14 +1078,7 @@ static struct page *allocate_slab(struct
>  	struct page *page;
>  	int pages = 1 << s->order;
>  
> -	if (s->order)
> -		flags |= __GFP_COMP;
> -
> -	if (s->flags & SLAB_CACHE_DMA)
> -		flags |= SLUB_DMA;
> -
> -	if (s->flags & SLAB_RECLAIM_ACCOUNT)
> -		flags |= __GFP_RECLAIMABLE;
> +	flags |= s->allocflags;
>  
>  	if (node == -1)
>  		page = alloc_pages(flags, s->order);
> @@ -2333,6 +2326,16 @@ static int calculate_sizes(struct kmem_c
>  	if (s->order < 0)
>  		return 0;
>  
> +	s->allocflags = 0;
> +	if (s->order)
> +		s->allocflags |= __GFP_COMP;
> +
> +	if (s->flags & SLAB_CACHE_DMA)
> +		s->allocflags |= SLUB_DMA;
> +
> +	if (s->flags & SLAB_RECLAIM_ACCOUNT)
> +		s->allocflags |= __GFP_RECLAIMABLE;
> +
>  	/*
>  	 * Determine the number of objects per slab
>  	 */
> 

Seems straight-forward.

Acked-by: Mel Gorman <mel@csn.ul.ie>

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2008-02-14 13:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080214040245.915842795@sgi.com>
     [not found] ` <20080214040314.388752493@sgi.com>
2008-02-14  7:14   ` [patch 5/5] slub: Large allocs for other slab sizes that do not fit in order 0 Pekka Enberg
2008-02-14 19:06     ` Christoph Lameter
2008-02-14  8:55   ` Pekka Enberg
     [not found] ` <20080214040313.318658830@sgi.com>
2008-02-14  7:23   ` [patch 1/5] slub: Determine gfpflags once and not every time a slab is allocated Pekka Enberg
2008-02-14 13:55   ` Mel Gorman [this message]
     [not found] ` <20080214040313.616551392@sgi.com>
2008-02-14  7:04   ` [patch 2/5] slub: Fallback to kmalloc_large for failing higher order allocs Pekka Enberg
2008-02-14  8:56   ` Pekka Enberg
2008-02-14 19:07     ` Christoph Lameter
2008-02-14 14:06   ` Mel Gorman
2008-02-14 19:10     ` Christoph Lameter
2008-02-14 19:23       ` Pekka Enberg
2008-02-14 19:32         ` Christoph Lameter
2008-02-14 19:47           ` Pekka Enberg
2008-02-14 19:57             ` Christoph Lameter
2008-02-14 20:02               ` Pekka Enberg
2008-02-14 20:08                 ` Christoph Lameter
2008-02-14 20:13                   ` Pekka Enberg
     [not found] ` <20080214040314.118141086@sgi.com>
2008-02-14  7:07   ` [patch 4/5] slub: Use __GFP_MOVABLE for slabs of HPAGE_SIZE Pekka Enberg
2008-02-14 19:04     ` Christoph Lameter
2008-02-14  8:57   ` Pekka Enberg
2008-02-14 19:07     ` Christoph Lameter
2008-02-14 14:14   ` Mel Gorman
2008-02-14 19:18     ` Christoph Lameter
2008-02-14 20:08       ` Mel Gorman
2008-02-14 20:14         ` Christoph Lameter
2008-02-14 20:25           ` Mel Gorman
2008-02-14 20:32             ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080214135548.GD17641@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).