[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170807133107.GA16616@redhat.com>
Date: Mon, 7 Aug 2017 09:31:07 -0400
From: Jerome Glisse <jglisse@...hat.com>
To: Igor Stoppa <igor.stoppa@...wei.com>
Cc: Michal Hocko <mhocko@...nel.org>, Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-security-module@...r.kernel.org,
"kernel-hardening@...ts.openwall.com"
<kernel-hardening@...ts.openwall.com>,
Kees Cook <keescook@...gle.com>
Subject: Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc
allocator
On Mon, Aug 07, 2017 at 02:26:21PM +0300, Igor Stoppa wrote:
> On 04/08/17 11:12, Michal Hocko wrote:
> > On Fri 04-08-17 11:02:46, Igor Stoppa wrote:
>
> [...]
>
> >> struct page {
> >> /* First double word block */
> >> unsigned long flags; /* Atomic flags, some possibly
> >> * updated asynchronously */
> >> union {
> >> struct address_space *mapping; /* If low bit clear, points to
> >> * inode address_space, or NULL.
> >> * If page mapped as anonymous
> >> * memory, low bit is set, and
> >> * it points to anon_vma object:
> >> * see PAGE_MAPPING_ANON below.
> >> */
> >> ...
> >> }
> >>
> >> mapping seems to be used exclusively in 2 ways, based on the value of
> >> its lower bit.
> >
> > Not really. The above applies to LRU pages. Please note that Slab pages
> > use s_mem and huge pages use compound_mapcount. If vmalloc pages are
> > using none of those already you can add a new field there.
>
> Yes, both from reading the code and some experimentation, it seems that
> vmalloc is not using either field.
>
> I'll add a vm_area field as you advised.
>
> Is this something I could send as standalone patch?
Note that vmalloc() is not the only thing that use vmalloc address
space. There is also vmap() and i know one set of drivers that use
vmap() and also use the mapping field of struct page namely GPU
drivers.
So like i said previously i would store a flag inside vm_struct to
know if page you are looking at are pmalloc or not. Again do you
need to store something per page ? Would storing it per vm_struct
not be enough ?
Cheers,
Jérôme
Powered by blists - more mailing lists