From: Matthew Wilcox <willy@infradead.org>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>,
Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org
Subject: Distinguishing VMalloc pages
Date: Mon, 11 Jun 2018 05:11:29 -0700 [thread overview]
Message-ID: <20180611121129.GB12912@bombadil.infradead.org> (raw)
I think we all like the idea of being able to look at a page [1] and
determine what it's used for. We have two places that we already look:
PageSlab
page_type
It's not possible to use page_type for VMalloc pages because that field
is in use for mapcount. We don't want to use another page flag bit.
I tried to use the page->mapping field in my earlier patch and that was
a problem because page_mapping() would return non-NULL, which broke
user-space unmapping of vmalloced pages through the zap_pte_range ->
set_page_dirty path.
I can see two alternatives to pursue here. One is that we already have
special casing in page_mapping():
if ((unsigned long)mapping & PAGE_MAPPING_ANON)
return NULL;
So changing:
-#define MAPPING_VMalloc (void *)0x440
+#define MAPPING_VMalloc (void *)0x441
in my original patch would lead to page_mapping() returning NULL.
Are there other paths where having a special value in page->mapping is
going to cause a problem? Indeed, is having the PAGE_MAPPING_ANON bit
set in these pages going to cause a problem? I just don't know those
code paths well enough.
Another possibility is putting a special value in one of the other
fields of struct page.
1. page->private is not available; everybody uses that field for
everything already, and there's no way that any value could be special
enough to be unique.
2. page->index (on 32-bit systems) can already have all possible values.
3. page->lru. The second word is already used for many random things,
but the first word is always either a pointer or compound_head (with
bit 0 set). So we could use a set of values with bits 0 & 1 clear, and
below 4kB (ie 1023 values total) to distinguish pages.
Any preferences/recommendations/words of warning?
[1] It may be helpful to refer to the 'new64' tab for a visual depiction:
https://docs.google.com/spreadsheets/d/1tvCszs_7FXrjei9_mtFiKV6nW1FLnYyvPvW-qNZhdog/edit#gid=1941250461
next reply other threads:[~2018-06-11 12:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 12:11 Matthew Wilcox [this message]
2018-06-11 17:25 ` Christopher Lameter
2018-06-11 17:59 ` Matthew Wilcox
2018-06-12 9:54 ` Igor Stoppa
2018-06-12 11:36 ` Matthew Wilcox
2018-06-12 12:35 ` Igor Stoppa
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=20180611121129.GB12912@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=aryabinin@virtuozzo.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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