linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Christoph Lameter" <cl@linux.com>,
	"Lai Jiangshan" <jiangshanlai@gmail.com>,
	"Pekka Enberg" <penberg@kernel.org>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Jérôme Glisse" <jglisse@redhat.com>
Subject: Re: [PATCH v7] mm: Distinguish VMalloc pages
Date: Wed, 11 Jul 2018 19:52:34 +0300	[thread overview]
Message-ID: <b9114b25-4ff2-045d-faf9-0747673e3957@virtuozzo.com> (raw)
In-Reply-To: <20180710165326.9378-1-willy@infradead.org>



On 07/10/2018 07:53 PM, Matthew Wilcox wrote:
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 21e1b6a9f113..8a4698b368de 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -153,6 +153,11 @@ struct page {
>  			spinlock_t ptl;
>  #endif
>  		};
> +		struct {	/* VMalloc pages */
> +			struct vm_struct *vm_area;
> +			unsigned long vm_offset;
> +			unsigned long _vm_id;	/* MAPPING_VMalloc */
> +		};
>  		struct {	/* ZONE_DEVICE pages */
>  			/** @pgmap: Points to the hosting device page map. */
>  			struct dev_pagemap *pgmap;
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 901943e4754b..588b8dd28a85 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -699,6 +699,32 @@ PAGE_TYPE_OPS(Kmemcg, kmemcg)
>   */
>  PAGE_TYPE_OPS(Table, table)
>  
> +/*
> + * vmalloc pages may be mapped to userspace, so we need some other way
> + * to distinguish them from other kinds of pages.  Use page->mapping for
> + * this purpose.  Values below 0x1000 cannot be real pointers.  Setting
> + * the bottom bit makes page_mapping() return NULL, which is what we want.
> + */
> +#define MAPPING_VMalloc		(void *)0x441

So this makes the vmalloc pages look like anon pages,
while previously they were !PageAnon.

I'm pretty sure this is not going to work.


> +
> +#define PAGE_MAPPING_OPS(name)						\
> +static __always_inline int Page##name(struct page *page)		\
> +{									\
> +	return page->mapping == MAPPING_##name;				\
> +}									\
> +static __always_inline void __SetPage##name(struct page *page)		\
> +{									\
> +	VM_BUG_ON_PAGE(page->mapping != NULL, page);			\
> +	page->mapping = MAPPING_##name;					\
> +}									\
> +static __always_inline void __ClearPage##name(struct page *page)	\
> +{									\
> +	VM_BUG_ON_PAGE(page->mapping != MAPPING_##name, page);		\
> +	page->mapping = NULL;						\
> +}
> +
> +PAGE_MAPPING_OPS(VMalloc)
> +

      reply	other threads:[~2018-07-11 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 16:53 Matthew Wilcox
2018-07-11 16:52 ` Andrey Ryabinin [this message]

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=b9114b25-4ff2-045d-faf9-0747673e3957@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jglisse@redhat.com \
    --cc=jiangshanlai@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /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