From: Andrew Morton <akpm@osdl.org>
To: Dean Nelson <dcn@sgi.com>
Cc: tony.luck@intel.com, jes@sgi.com, avolkov@varma-el.com,
linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] change gen_pool allocator to not touch managed memory
Date: Tue, 25 Apr 2006 01:16:26 +0000 [thread overview]
Message-ID: <20060424181626.09966912.akpm@osdl.org> (raw)
In-Reply-To: <444D1A7E.mailx85W11DZZU@aqua.americas.sgi.com>
dcn@sgi.com (Dean Nelson) wrote:
>
>
> The following patch modifies the gen_pool allocator (lib/genalloc.c) to
> utilize a bitmap scheme instead of the buddy scheme. The purpose of this
> change is to eliminate the touching of the actual memory being allocated.
>
> Since the change modifies the interface, a change to the uncached
> allocator (arch/ia64/kernel/uncached.c) is also required.
>
> Signed-off-by: Dean Nelson <dcn@sgi.com>
>
> ---
>
> Andrew,
>
> Both Andrey Volkov and Jes Sorenson have expressed a desire that the
> gen_pool allocator not write to the memory being managed. See the
> following:
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m\x113518602713125&w=2
> http://marc.theaimsgroup.com/?l=linux-kernel&m\x113533568827916&w=2
hm, fair enough.
The patch is fairly large+intrusive. I trust it's been broadly tested?
> -unsigned long gen_pool_alloc(struct gen_pool *poolp, int size)
> +int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,
> + int nid)
> {
> - int j, i, s, max_chunk_size;
> - unsigned long a, flags;
> - struct gen_pool_link *h = poolp->h;
> + struct gen_pool_chunk *chunk;
> + int nbits = size >> pool->min_alloc_order;
> + int nbytes = sizeof(struct gen_pool_chunk) + nbits / 8;
We can use BITS_PER_BYTE rather than "8".
I have a suspicion that `nbytes' here needs to be rounded up.
> + if (nbytes > PAGE_SIZE) {
> + if (nid = GENALLOC_NID_NONE)
> + chunk = vmalloc(nbytes);
> + else
> + chunk = vmalloc_node(nbytes, nid);
> + } else {
> + if (nid = GENALLOC_NID_NONE)
> + chunk = kmalloc(nbytes, GFP_KERNEL);
> + else
> + chunk = kmalloc_node(nbytes, GFP_KERNEL, nid);
> + }
I don't think GENALLOC_NID_NONE needs to exist. If the caller passes in
`nid=-1', kmalloc_node() will do what you want.
Which is an apparently-undocumented feature...
next prev parent reply other threads:[~2006-04-25 1:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-24 18:35 [PATCH] change gen_pool allocator to not touch managed memory Dean Nelson
2006-04-25 1:16 ` Andrew Morton [this message]
2006-04-25 15:50 ` Dean Nelson
2006-04-26 9:12 ` Jes Sorensen
2006-04-26 11:08 ` Robin Holt
2006-04-26 11:18 ` Jes Sorensen
2006-04-26 13:28 ` Dean Nelson
2006-04-26 13:42 ` Jes Sorensen
2006-04-26 16:31 ` Dean Nelson
2006-04-28 12:49 ` Jes Sorensen
2006-04-26 10:27 ` Jesper Juhl
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=20060424181626.09966912.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=avolkov@varma-el.com \
--cc=dcn@sgi.com \
--cc=jes@sgi.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.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