linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.com>
To: Peter Xu <peterx@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Khalid Aziz <khalid.aziz@oracle.com>,
	Vishal Moola <vishal.moola@gmail.com>,
	Jane Chu <jane.chu@oracle.com>,
	Muchun Song <muchun.song@linux.dev>,
	linux-mm@kvack.org
Subject: Re: Unifying page table walkers
Date: Fri, 7 Jun 2024 07:07:27 +0200	[thread overview]
Message-ID: <ZmKVj-e6HunvN833@localhost.localdomain> (raw)
In-Reply-To: <ZmIu6v0hKbQBBrLI@x1n>

On Thu, Jun 06, 2024 at 05:49:30PM -0400, Peter Xu wrote:
> On Thu, Jun 06, 2024 at 07:29:22PM +0100, Matthew Wilcox wrote:
> > The reason we have a separate hugetlb_entry from pmd_entry and pud_entry
> > is that it has a different locking context.  It is called with the
> > hugetlb_vma_lock held for read (nb: this is not the same as the vma
> > lock; see walk_hugetlb_range()).  Why do we need this?  Because of page
> > table sharing.
> 
> Just to quickly comment on this one: I think it's more than the per-vma
> lock.  Oscar is actually working together with me (we had plenty of
> discussions but so far all offlist...), and the lock context is as simple
> as this after refactor for hugetlb_entry() path:
> 
> https://github.com/leberus/linux/commit/88e56c1ecaf8c64ba9165aeba74335bdc15d1b56

Yes, I reached out to Peter after LSFMM because I was highly interested in
helping out here.
We agreed that I would take pagewalk part, and I already do have some
patches on the works [1][2] that are based on a patchset that I have been
reviewing that removes hugepd on powerpc [3].

Ideally we should remove the exclusive use of 'pte' from hugetlb (unless
it is CONTPTE) and have it using pud/pmd where needed.
E.g: if we look at huge_ptep_get version from s390, which is the most
special one I would say:

huge_ptep_get()->__rste_to_pte or they way around (__pte_to_rste)

what it does is it tries to convert a pud/pmd entry into a pte or viceversa,
since hugetlb "can" only work with that, and so you have all this castings back
and forth all spread over.

I started first merging all .hugetlb_entry functions into the .pmd_entrys
(not done yet, half-way through) and creating .pud_entry because we will
need them since hugetlb can be PUD-mapped, unlike THP (well, yes, devmp
but most walkers do not care about it so they did not create a
.pud_entry).

Then I will be running some tests on x86_64/arm64/pp64le and s390(not
sure if I will be able to grab one but let us see), and then I will post
a patchset as RFC to gather some feedback.

[1] https://github.com/leberus/linux/tree/hugetlb-pagewalk-v2
[2] Do not stare too close as they are a very WIP, and ignore the last 4 commits
    as they are half-done.
[3] https://patchwork.kernel.org/project/linux-mm/cover/cover.1716815901.git.christophe.leroy@csgroup.eu/


-- 
Oscar Salvador
SUSE Labs


  reply	other threads:[~2024-06-07  5:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 18:29 Matthew Wilcox
2024-06-06 19:30 ` James Houghton
2024-06-06 20:04   ` Matthew Wilcox
2024-06-06 20:23     ` James Houghton
2024-06-06 21:21       ` Matthew Wilcox
2024-06-06 23:07         ` James Houghton
2024-06-07  7:15           ` David Hildenbrand
2024-06-06 21:33     ` Peter Xu
2024-06-06 21:49 ` Peter Xu
2024-06-07  5:07   ` Oscar Salvador [this message]
2024-06-07  6:59 ` David Hildenbrand
2024-06-09 20:08   ` Matthew Wilcox
2024-06-09 20:28     ` David Hildenbrand

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=ZmKVj-e6HunvN833@localhost.localdomain \
    --to=osalvador@suse.com \
    --cc=jane.chu@oracle.com \
    --cc=khalid.aziz@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=peterx@redhat.com \
    --cc=vishal.moola@gmail.com \
    --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