linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: James Houghton <jthoughton@google.com>
Cc: Khalid Aziz <khalid.aziz@oracle.com>,
	Peter Xu <peterx@redhat.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: Thu, 6 Jun 2024 21:04:53 +0100	[thread overview]
Message-ID: <ZmIWZWOeN2fLaJ3T@casper.infradead.org> (raw)
In-Reply-To: <CADrL8HWMvyzaW0xTvgAJenBwRPyoKQNT7dYLN6Sh2D7xdmRf+Q@mail.gmail.com>

On Thu, Jun 06, 2024 at 12:30:44PM -0700, James Houghton wrote:
> Today the VM_HUGETLB flag tells the fault handler to call into
> hugetlb_fault() (there are many other special cases, but this one is
> probably the most important). How should faults on VMAs without
> VM_HUGETLB that map HugeTLB folios be handled? If you handle faults
> with the main mm fault handler without getting rid of hugetlb_fault(),
> I think you're basically implementing a second, more tmpfs-like
> hugetlbfs... right?
> 
> I don't really have anything against this approach, but I think the
> decision was to reduce the number of special cases as much as we can
> first before attempting to rewrite hugetlbfs.
> 
> Or maybe I've got something wrong and what you're asking doesn't
> logically end up at a hugetlbfs v2.

Right, so we ignore hugetlb_fault() and call into __handle_mm_fault().
Once there, we'll do:

        vmf.pud = pud_alloc(mm, p4d, address);
        if (pud_none(*vmf.pud) &&
            thp_vma_allowable_order(vma, vm_flags,
                                TVA_IN_PF | TVA_ENFORCE_SYSFS, PUD_ORDER)) {
                ret = create_huge_pud(&vmf);

which will call vma->vm_ops->huge_fault(vmf, PUD_ORDER);

So all we need to do is implement huge_fault in hugetlb_vm_ops.  I
don't think that's the same as creating a hugetlbfs2 because it's just
another entry point.  You can mmap() the same file both ways and it's
all cache coherent.



  reply	other threads:[~2024-06-06 20:05 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 [this message]
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
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=ZmIWZWOeN2fLaJ3T@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=jane.chu@oracle.com \
    --cc=jthoughton@google.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 \
    /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