linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: James Houghton <jthoughton@google.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	stable@vger.kernel.org, Peter Xu <peterx@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Muchun Song <muchun.song@linux.dev>,
	Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: Re: [PATCH v2] mm/hugetlb: fix hugetlb vs. core-mm PT locking
Date: Tue, 30 Jul 2024 23:00:00 +0200	[thread overview]
Message-ID: <3f6c97b5-ccd8-4226-a9ac-78d555b0d048@redhat.com> (raw)
In-Reply-To: <CADrL8HXRCNFzmg67p=j0_0Y_NAFo5rUDmvnr40F5HGAsQMvbnw@mail.gmail.com>

On 30.07.24 22:43, James Houghton wrote:
> On Tue, Jul 30, 2024 at 1:03 PM David Hildenbrand <david@redhat.com> wrote:
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index b100df8cb5857..1b1f40ff00b7d 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -2926,6 +2926,12 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
>>          return ptlock_ptr(page_ptdesc(pmd_page(*pmd)));
>>   }
>>
>> +static inline spinlock_t *ptep_lockptr(struct mm_struct *mm, pte_t *pte)
>> +{
>> +       BUILD_BUG_ON(IS_ENABLED(CONFIG_HIGHPTE));
>> +       return ptlock_ptr(virt_to_ptdesc(pte));
> 
> Hi David,
> 

Hi!

> Small question: ptep_lockptr() does not handle the case where the size
> of the PTE table is larger than PAGE_SIZE, but pmd_lockptr() does.

I thought I convinced myself that leaf page tables are always single 
pages and had a comment in v1.

But now I have to double-check again, and staring at 
pagetable_pte_ctor() callers I am left confused.

It certainly sounds more future proof to just align the pointer down to 
the start of the PTE table like pmd_lockptr() would.

> IIUC, for pte_lockptr() and ptep_lockptr() to return the same result
> in this case, ptep_lockptr() should be doing the masking that
> pmd_lockptr() is doing. Are you sure that you don't need to be doing
> it? (Or maybe I am misunderstanding something.)

It's a valid concern even if it would not be required. But I'm afraid I 
won't dig into the details and simply do the alignment in a v3.

I'm hoping I'll be done with that hugetlb crap soon; it's starting to 
annoy me and I really should be working on other stuff ...

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-07-30 21:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 20:03 David Hildenbrand
2024-07-30 20:43 ` James Houghton
2024-07-30 21:00   ` David Hildenbrand [this message]
2024-07-30 21:07     ` David Hildenbrand
2024-07-30 21:17       ` James Houghton
2024-07-30 21:19         ` David Hildenbrand
2024-07-30 22:30   ` Peter Xu

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=3f6c97b5-ccd8-4226-a9ac-78d555b0d048@redhat.com \
    --to=david@redhat.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=jthoughton@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=stable@vger.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