[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <754ae8a0-23af-4c87-953f-d608cba84191@default>
Date: Wed, 29 May 2013 14:09:02 -0700 (PDT)
From: Dan Magenheimer <dan.magenheimer@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Seth Jennings <sjenning@...ux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nitin Gupta <ngupta@...are.org>,
Minchan Kim <minchan@...nel.org>,
Konrad Wilk <konrad.wilk@...cle.com>,
Robert Jennings <rcj@...ux.vnet.ibm.com>,
Jenifer Hopper <jhopper@...ibm.com>,
Mel Gorman <mgorman@...e.de>,
Johannes Weiner <jweiner@...hat.com>,
Rik van Riel <riel@...hat.com>,
Larry Woodman <lwoodman@...hat.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Dave Hansen <dave@...1.net>, Joe Perches <joe@...ches.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Cody P Schafer <cody@...ux.vnet.ibm.com>,
Hugh Dickens <hughd@...gle.com>,
Paul Mackerras <paulus@...ba.org>,
Heesub Shin <heesub.shin@...sung.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org
Subject: RE: [PATCHv12 2/4] zbud: add to mm/
> From: Andrew Morton [mailto:akpm@...ux-foundation.org]
> Subject: Re: [PATCHv12 2/4] zbud: add to mm/
>
> On Wed, 29 May 2013 15:42:36 -0500 Seth Jennings <sjenning@...ux.vnet.ibm.com> wrote:
>
> > > > > I worry about any code which independently looks at the pageframe
> > > > > tables and expects to find page struts there. One example is probably
> > > > > memory_failure() but there are probably others.
> > >
> > > ^^ this, please. It could be kinda fatal.
> >
> > I'll look into this.
> >
> > The expected behavior is that memory_failure() should handle zbud pages in the
> > same way that it handles in-use slub/slab/slob pages and return -EBUSY.
>
> memory_failure() is merely an example of a general problem: code which
> reads from the memmap[] array and expects its elements to be of type
> `struct page'. Other examples might be memory hotplugging, memory leak
> checkers etc. I have vague memories of out-of-tree patches
> (bigphysarea?) doing this as well.
>
> It's a general problem to which we need a general solution.
<Obi-tmem Kenobe slowly materializes... "use the force, Luke!">
One could reasonably argue that any code that makes incorrect
assumptions about the contents of a struct page structure is buggy
and should be fixed. Isn't the "general solution" already described
in the following comment, excerpted from include/linux/mm.h, which
implies that "scribbling on existing pageframes" [carefully], is fine?
(And, if not, shouldn't that comment be fixed, or am I misreading
it?)
<start excerpt>
* For the non-reserved pages, page_count(page) denotes a reference count.
* page_count() == 0 means the page is free. page->lru is then used for
* freelist management in the buddy allocator.
* page_count() > 0 means the page has been allocated.
*
* Pages are allocated by the slab allocator in order to provide memory
* to kmalloc and kmem_cache_alloc. In this case, the management of the
* page, and the fields in 'struct page' are the responsibility of mm/slab.c
* unless a particular usage is carefully commented. (the responsibility of
* freeing the kmalloc memory is the caller's, of course).
*
* A page may be used by anyone else who does a __get_free_page().
* In this case, page_count still tracks the references, and should only
* be used through the normal accessor functions. The top bits of page->flags
* and page->virtual store page management information, but all other fields
* are unused and could be used privately, carefully. The management of this
* page is the responsibility of the one who allocated it, and those who have
* subsequently been given references to it.
*
* The other pages (we may call them "pagecache pages") are completely
* managed by the Linux memory manager: I/O, buffers, swapping etc.
* The following discussion applies only to them.
<end excerpt>
<Obi-tmem Kenobe slowly dematerializes>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists