linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ak@suse.de
Subject: Re: [QUICKLIST 1/4] Quicklists for page table pages V5
Date: Mon, 9 Apr 2007 14:27:05 -0700	[thread overview]
Message-ID: <20070409142705.55fa0f34.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070409182509.8559.33823.sendpatchset@schroedinger.engr.sgi.com>

On Mon,  9 Apr 2007 11:25:09 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> Quicklists for page table pages V5
> 
> ...
>
> +/*
> + * The two key functions quicklist_alloc and quicklist_free are inline so
> + * that they may be custom compiled for the platform.
> + * Specifying a NULL ctor can remove constructor support. Specifying
> + * a constant quicklist allows the determination of the exact address
> + * in the per cpu area.
> + *
> + * The fast patch in quicklist_alloc touched only a per cpu cacheline and
> + * the first cacheline of the page itself. There is minmal overhead involved.
> + */
> +static inline void *quicklist_alloc(int nr, gfp_t flags, void (*ctor)(void *))
> +{
> +	struct quicklist *q;
> +	void **p = NULL;
> +
> +	q =&get_cpu_var(quicklist)[nr];
> +	p = q->page;
> +	if (likely(p)) {
> +		q->page = p[0];
> +		p[0] = NULL;
> +		q->nr_pages--;
> +	}
> +	put_cpu_var(quicklist);
> +	if (likely(p))
> +		return p;
> +
> +	p = (void *)__get_free_page(flags | __GFP_ZERO);
> +	if (ctor && p)
> +		ctor(p);
> +	return p;
> +}
> +
> +static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
> +	struct page *page)
> +{
> +	struct quicklist *q;
> +	int nid = page_to_nid(page);
> +
> +	if (unlikely(nid != numa_node_id())) {
> +		if (dtor)
> +			dtor(p);
> +		free_page((unsigned long)p);

free_page() has to run virt_to_page(), but we already have the page*.

> +		return;
> +	}
> +
> +	q = &get_cpu_var(quicklist)[nr];
> +	*(void **)p = q->page;
> +	q->page = p;
> +	q->nr_pages++;
> +	put_cpu_var(quicklist);
> +}
> +
> +static inline void quicklist_free(int nr, void (*dtor)(void *), void *pp)
> +{
> +	__quicklist_free(nr, dtor, pp, virt_to_page(pp));
> +}
> +
> +static inline void quicklist_free_page(int nr, void (*dtor)(void *),
> +							struct page *page)
> +{
> +	__quicklist_free(nr, dtor, page_address(page), page);
> +}

All this (still) seems way too big to be inlined.  I'm showing a 20-odd
byte reduction in x86_64's memory.o text when it is uninlined.  Pretty
modest I guess.

--
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:[~2007-04-09 21:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-09 18:25 Christoph Lameter
2007-04-09 18:25 ` [QUICKLIST 2/4] Quicklist support for IA64 Christoph Lameter
2007-04-09 18:25 ` [QUICKLIST 3/4] Quicklist support for x86_64 Christoph Lameter
2007-04-09 18:43   ` Andi Kleen
2007-04-09 18:46     ` Christoph Lameter
2007-04-09 18:49       ` Andi Kleen
2007-04-09 18:51         ` Christoph Lameter
2007-04-09 18:53           ` Andi Kleen
2007-04-09 18:56             ` Christoph Lameter
2007-04-09 21:28   ` Andrew Morton
2007-04-09 22:01     ` Christoph Lameter
2007-04-09 18:25 ` [QUICKLIST 4/4] Quicklist support for sparc64 Christoph Lameter, David Miller
2007-04-09 18:48 ` [QUICKLIST 1/4] Quicklists for page table pages V5 Andrew Morton
2007-04-09 18:50   ` Christoph Lameter
2007-04-09 21:27 ` Andrew Morton [this message]
2007-04-09 21:41 ` Andrew Morton
2007-04-09 22:03   ` Christoph Lameter
2007-04-10  0:26     ` William Lee Irwin III
2007-04-10  0:53       ` Christoph Lameter
2007-04-10  4:45 ` Benjamin Herrenschmidt
2007-04-11  4:04   ` Christoph Lameter
2007-04-11  4:18     ` Benjamin Herrenschmidt
2007-04-11  5:41       ` Paul Mackerras
2007-04-11  6:15         ` Benjamin Herrenschmidt

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=20070409142705.55fa0f34.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@suse.de \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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