From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>,
Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
Nitin Gupta <ngupta@vflare.org>,
Brian King <brking@linux.vnet.ibm.com>,
Konrad Wilk <konrad.wilk@oracle.com>,
linux-mm@kvack.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library
Date: Wed, 8 Feb 2012 09:15:36 -0800 (PST) [thread overview]
Message-ID: <409797c4-a6e7-493d-9681-4166a9473ab8@default> (raw)
In-Reply-To: <4F32A55E.8010401@linux.vnet.ibm.com>
> From: Dave Hansen [mailto:dave@linux.vnet.ibm.com]
> Subject: Re: [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library
>
> On 02/06/2012 09:26 AM, Seth Jennings wrote:
> > On 01/26/2012 01:12 PM, Dave Hansen wrote:
> >> void *kmap_atomic_prot(struct page *page, pgprot_t prot)
> >> {
> >> ...
> >> type = kmap_atomic_idx_push();
> >> idx = type + KM_TYPE_NR*smp_processor_id();
> >> vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
> >>
> >> I think if you do a get_cpu()/put_cpu() or just a preempt_disable()
> >> across the operations you'll be guaranteed to get two contiguous addresses.
> >
> > I'm not quite following here. kmap_atomic() only does this for highmem pages.
> > For normal pages (all pages for 64-bit), it doesn't do any mapping at all. It
> > just returns the virtual address of the page since it is in the kernel's address
> > space.
> >
> > For this design, the pages _must_ be mapped, even if the pages are directly
> > reachable in the address space, because they must be virtually contiguous.
>
> I guess you could use vmap() for that. It's just going to be slower
> than kmap_atomic(). I'm really not sure it's worth all the trouble to
> avoid order-1 allocations, though.
Seth, Nitin, please correct me if I am wrong, but...
Dave, your comment makes me wonder if maybe you might be missing
the key value of the new allocator. The zsmalloc allocator can grab
any random* page "A" with X unused bytes at the END of the page,
and any random page "B" with Y unused bytes at the BEGINNING of the page
and "coalesce" them to store any byte sequence with a length** Z
not exceeding X+Y. Presumably this markedly increases
the density of compressed-pages-stored-per-physical-page***. I don't
see how allowing order-1 allocations helps here but if I am missing
something clever, please explain further.
(If anyone missed Jonathan Corbet's nice lwn.net article, see:
https://lwn.net/Articles/477067/ )
* Not really ANY random page, just any random page that has been
previously get_free_page'd by the allocator and hasn't been
free'd yet.
** X, Y and Z are all rounded to a multiple of 16 so there
is still some internal fragmentation cost.
*** Would be interesting to see some random and real workload data
comparing density for zsmalloc and xvmalloc. And also zbud
too as a goal is to replace zbud with zsmalloc too.
next prev parent reply other threads:[~2012-02-08 17:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-09 22:51 [PATCH 0/5] staging: zsmalloc: memory allocator for compressed pages Seth Jennings
2012-01-09 22:51 ` [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library Seth Jennings
2012-01-20 22:12 ` Andrew Morton
2012-01-23 14:36 ` Seth Jennings
2012-01-23 18:57 ` Nitin Gupta
2012-01-23 19:40 ` Andrew Morton
2012-01-26 19:12 ` Dave Hansen
2012-02-06 17:26 ` Seth Jennings
2012-02-08 16:39 ` Dave Hansen
2012-02-08 17:15 ` Dan Magenheimer [this message]
2012-02-08 17:21 ` Dave Hansen
2012-02-08 17:53 ` Nitin Gupta
2012-02-08 18:28 ` Dave Hansen
2012-02-08 20:57 ` Nitin Gupta
2012-02-08 21:39 ` Dan Magenheimer
2012-02-08 23:07 ` Dave Hansen
2012-01-09 22:51 ` [PATCH 2/5] staging: add zsmalloc to Kconfig/Makefile Seth Jennings
2012-01-09 22:51 ` [PATCH 3/5] staging: zcache: replace xvmalloc with zsmalloc Seth Jennings
2012-02-09 1:13 ` Greg KH
2012-02-09 14:36 ` Seth Jennings
2012-02-09 14:55 ` Seth Jennings
2012-02-09 18:13 ` Greg KH
2012-02-09 18:28 ` Seth Jennings
2012-01-09 22:51 ` [PATCH 4/5] staging: zram: " Seth Jennings
2012-01-09 22:52 ` [PATCH 5/5] staging: zram: remove xvmalloc Seth Jennings
2012-01-09 23:09 ` [PATCH 0/5] staging: zsmalloc: memory allocator for compressed pages Greg KH
2012-01-09 23:26 ` Seth Jennings
2012-01-20 22:03 ` Andrew Morton
2012-01-23 14:27 ` Seth Jennings
[not found] <<1326149520-31720-1-git-send-email-sjenning@linux.vnet.ibm.com>
[not found] ` <<1326149520-31720-2-git-send-email-sjenning@linux.vnet.ibm.com>
2012-01-11 17:19 ` [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library Dan Magenheimer
2012-01-11 17:45 ` Seth Jennings
2012-01-11 21:44 ` Dan Magenheimer
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=409797c4-a6e7-493d-9681-4166a9473ab8@default \
--to=dan.magenheimer@oracle.com \
--cc=brking@linux.vnet.ibm.com \
--cc=dave@linux.vnet.ibm.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=sjenning@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).