From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: 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>,
Dave Hansen <dave@linux.vnet.ibm.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, 11 Jan 2012 13:44:49 -0800 (PST) [thread overview]
Message-ID: <1caa64c1-a36d-4779-a757-1a653ecd88d6@default> (raw)
In-Reply-To: <4F0DCAA7.4000601@linux.vnet.ibm.com>
> From: Seth Jennings [mailto:sjenning@linux.vnet.ibm.com]
> Subject: Re: [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library
>
> On 01/11/2012 11:19 AM, Dan Magenheimer wrote:
> >> From: Seth Jennings [mailto:sjenning@linux.vnet.ibm.com]
> >> Subject: [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library
> >>
> >> From: Nitin Gupta <ngupta@vflare.org>
> >>
> >> This patch creates a new memory allocation library named
> >> zsmalloc.
> >>
> >> +/*
> >> + * Allocate a zspage for the given size class
> >> + */
> >> +static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
> >> +{
> >> + int i, error;
> >> + struct page *first_page = NULL;
> >> +
> >> + /*
> >> + * Allocate individual pages and link them together as:
> >> + * 1. first page->private = first sub-page
> >> + * 2. all sub-pages are linked together using page->lru
> >> + * 3. each sub-page is linked to the first page using page->first_page
> >> + *
> >> + * For each size class, First/Head pages are linked together using
> >> + * page->lru. Also, we set PG_private to identify the first page
> >> + * (i.e. no other sub-page has this flag set) and PG_private_2 to
> >> + * identify the last page.
> >> + */
> >> + error = -ENOMEM;
> >> + for (i = 0; i < class->zspage_order; i++) {
> >> + struct page *page, *prev_page;
> >> +
> >> + page = alloc_page(flags);
> >
> > Hmmm... I thought we agreed offlist that the new allocator API would
> > provide for either preloads or callbacks (which may differ per pool)
> > instead of directly allocating raw pages from the kernel. The caller
> > (zcache or ramster or ???) needs to be able to somehow manage maximum
> > memory capacity to avoid OOMs.
> >
> > Or am I missing the code that handles that?
>
> No, you aren't missing it; it's not there. And I agree that we
> should add that.
>
> However, the existing allocator, xvmalloc, doesn't support callback
> functionality either. Would it be simpler to add the that as
> a separate patch, that way we can keep the changes to zcache/zram
> in this patchset isolated to just changing the xvmalloc calls to
> zsmalloc calls?
OK, I'll buy that. Since you haven't changed any of the policy
code, and the allocator is (purportedly) more storage-efficient on
any sequence of chunks stored in it, the potential for OOMs shouldn't
get any worse.
Dan
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-01-11 21:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
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
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
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=1caa64c1-a36d-4779-a757-1a653ecd88d6@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).