From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andy Lutomirski <luto@amacapital.net>,
x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: Proof-of-concept: better(?) page-table manipulation API
Date: Sat, 5 May 2018 00:49:36 +0300 [thread overview]
Message-ID: <20180504214936.v62knybljdvcnifq@black.fi.intel.com> (raw)
In-Reply-To: <20180504211244.GD29829@bombadil.infradead.org>
On Fri, May 04, 2018 at 09:12:44PM +0000, Matthew Wilcox wrote:
> On Tue, Apr 24, 2018 at 06:43:56PM +0300, Kirill A. Shutemov wrote:
> > +struct pt_ptr {
> > + unsigned long *ptr;
> > + int lvl;
> > +};
>
> On x86, you've got three kinds of paging scheme, referred to in the manual
> as 32-bit, PAE and 4-level.
You forgot 5-level :)
(although it's not in the manual yet, so fair enough)
> On 32-bit, you've got 3 levels (Directory, Table and Entry), and you can
> encode those three levels in the bottom two bits of the pointer. With
> PAE and 4L, pointers are 64-bit aligned, so you can encode up to eight
> levels in the bottom three bits of the pointer.
I didn't thought about this. Thank you.
> > +struct pt_val {
> > + unsigned long val;
> > + int lvl;
> > +};
>
> I don't think it's possible to shrink this down to a single ulong.
> _Maybe_ it is if you can squirm a single bit free from the !pte_present
> case.
I don't think it worth it. It gets tricky quickly.
> ... this is only for x86 4L and maybe 32 paging, right? It'd need to
> use unsigned long val[2] for PAE.
I didn't look at 32-bit at all. But 4L and 5L [kinda] work.
> I'm going to think about this some more. There's a lot of potential here.
Thanks for the input.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2018-05-04 21:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 15:43 Proof-of-concept: better(?) page-table manipulation API Kirill A. Shutemov
2018-05-04 21:12 ` Matthew Wilcox
2018-05-04 21:49 ` Kirill A. Shutemov [this message]
2018-05-07 4:51 ` Andy Lutomirski
2018-05-07 11:31 ` Kirill A. Shutemov
2018-05-07 12:23 ` Matthew Wilcox
2018-05-07 13:10 ` Kirill A. Shutemov
2018-05-08 21:04 ` Andy Lutomirski
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=20180504214936.v62knybljdvcnifq@black.fi.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@amacapital.net \
--cc=mhocko@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
--cc=x86@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;
as well as URLs for NNTP newsgroup(s).