From: Andrew Morton <akpm@zip.com.au>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Rik van Riel <riel@conectiva.com.br>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: how not to write a search algorithm
Date: Mon, 05 Aug 2002 01:44:06 -0700 [thread overview]
Message-ID: <3D4E3AD6.2010A02B@zip.com.au> (raw)
In-Reply-To: <20020805074042.GL4010@holomorphy.com>
William Lee Irwin III wrote:
>
> William Lee Irwin III wrote:
> >> (2) only needs the reservation bits from the preceding post if it's
> >> just dealing with kmem_cache_alloc() returning NULL.
>
> On Sun, Aug 04, 2002 at 08:00:27PM -0700, Andrew Morton wrote:
> > Well I think we'll need a per-cpu-pages thing to amortise zone->lock
> > contention anyway. So what we can do is:
> > fill_up_the_per_cpu_buffer(GFP_KERNEL); /* disables preemption */
> > spin_lock(lock);
> > allocate(GFP_ATOMIC);
> > spin_unlock(lock);
> > preempt_enable();
> > We also prevent interrupt-time allocations from
> > stealing the final four pages from the per-cpu buffer.
> > The allocation is guaranteed to succeed, yes? Can use
> > it for ratnodes as well.
>
> NFI how this is supposed to work with slab caches and/or get around the
> GFP_ATOMIC failing.
The GFP_ATOMIC allocation can't fail. We've gone and arranged for
this CPU to have (say) eight free pages, all to itself. If we
also arrange for interrupt context to leave at least four behind,
we *know* that there are pages available to the atomic allocation.
So if the slab allocation needs a page, it will get it from the
cpu-local pool.
It can fail if the allocation is higher-order, but we won't do that.
The nice thing is that it 99% leverages a per-cpu-pages mechanism.
We'd have to make fill_up_the_per_cpu_buffer() loop for ever
(but the page allocator does that anyway) or handle a failure
from that. Just loop, I'd say. Provided the caller isn't holding any
semaphores.
--
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/
next prev parent reply other threads:[~2002-08-05 8:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-04 8:35 Andrew Morton
2002-08-04 13:16 ` Rik van Riel
2002-08-04 20:00 ` Andrew Morton
2002-08-04 19:54 ` Rik van Riel
2002-08-04 20:38 ` William Lee Irwin III
2002-08-04 21:09 ` Andrew Morton
2002-08-04 22:02 ` William Lee Irwin III
2002-08-04 22:43 ` Andrew Morton
2002-08-04 22:47 ` William Lee Irwin III
2002-08-05 3:00 ` Andrew Morton
2002-08-05 2:55 ` Rik van Riel
2002-08-05 7:40 ` William Lee Irwin III
2002-08-05 8:44 ` Andrew Morton [this message]
2002-08-05 10:50 ` William Lee Irwin III
2002-08-04 22:45 ` Daniel Phillips
2002-08-04 23:03 ` Andrew Morton
2002-08-04 23:00 ` William Lee Irwin III
2002-08-04 23:02 ` Daniel Phillips
2002-08-04 23:21 ` Andrew Morton
2002-08-05 0:03 ` Daniel Phillips
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=3D4E3AD6.2010A02B@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-mm@kvack.org \
--cc=riel@conectiva.com.br \
--cc=wli@holomorphy.com \
/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