All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/thp: Make ARCH_ENABLE_SPLIT_PMD_PTLOCK dependent on PGTABLE_LEVELS > 2
Date: Mon, 24 May 2021 15:11:27 +0530	[thread overview]
Message-ID: <06299fb2-2f64-9094-3bf4-77045101ae22@arm.com> (raw)
In-Reply-To: <20210519130722.7d255b7f@thinkpad>



On 5/19/21 4:37 PM, Gerald Schaefer wrote:
> On Mon, 17 May 2021 16:13:57 +0200
> Gerald Schaefer <gerald.schaefer@linux.ibm.com> wrote:
> 
>> On Mon, 17 May 2021 09:45:31 +0530
>> Anshuman Khandual <anshuman.khandual@arm.com> wrote:
>>
>>>
>>>
>>> On 5/10/21 10:05 AM, Anshuman Khandual wrote:  
>>>> ARCH_ENABLE_SPLIT_PMD_PTLOCK is irrelevant unless there are two page table
>>>> levels including PMD (also per Documentation/vm/split_page_table_lock.rst).
>>>> Make this dependency explicit on remaining platforms i.e x86 and s390 where
>>>> ARCH_ENABLE_SPLIT_PMD_PTLOCK is subscribed.  
>>
>> For s390, I don't think this makes a lot of sense. We always have 5 levels
>> defined for PGTABLE_LEVELS, and we would not even compile with any other
>> value, because of the "#error CONFIG_PGTABLE_LEVELS" in include/linux/pgtable.h.
>>
>> Our pagetable folding also works a bit different than it does on other archs,
>> and we would actually have pmd level entries for 2-level pagetables, so it should
>> all work fine also with PGTABLE_LEVELS == 2 (if it was possible).
>>
>> In fact, I do not really see why you would need "more than two levels" on any
>> arch, in order to use split PMD locks. Your description also just says
>> "irrelevant unless there are two page table levels", and not "more than two
>> levels", like in Documentation/vm/split_page_table_lock.rst.
>>
>> Yet, your patch adds checks for "more than", so at least the description
>> seems a bit misleading. I assume that the "more than" has to do with folded
>> PMD on a 2-level system, but the way we fold on s390 I do not see why that
>> should be a problem. Could you please elaborate a bit?
>>
>> We also have different levels of pagetables for kernel (CONFIG_PGTABLE_LEVELS)
>> and user processes on s390. The latter can have dynamic levels, currently
>> starting with 3, but previously we also had 2 levels for compat tasks e.g.
>> These dynamic levels for user processes are also independent from the
>> CONFIG_PGTABLE_LEVELS used for the kernel pagetable, while the split PMD lock
>> of course also affects user process pagetables, so that would be another
>> reason not to add such a dependency for ARCH_ENABLE_SPLIT_PMD_PTLOCK on s390.
> 
> Ouch, I guess I was a bit confused here. I thought the split PMD lock
> was part of the struct page for the 4 KB page where the PMD entry is located,
> and therefore, with more than one page, it still would make (a little) sense
> to use it also for 2 pagetable levels.
> 
> However, pmd_to_page() always returns the struct page of the first page,
> so there is only one split PMD lock for the whole thing (4 pages for s390).
> Of course that means that with 2 pagetable levels, and only one PMD directory,
> the split PMD lock would be equivalent to the global pagetable lock, and
> therefore not make any sense.
> 
> Maybe you could change the description to also mention "more than two"
> levels?

Yes, will change it.

> 
> I still do not see a real benefit of the patch, e.g. it does not really
> fix any possible misconfiguration, at least on s390. But it certainly is not
> wrong, and at least it had the benefit of making me aware again of how split
> PMD locks work, so I'll happily add this

Right, even though it does not change the functionality, the purpose
of this patch is to enforce (and also possibly document) an inherent
assumption which may not hold true on all other platforms like arm64.

> 
> Acked-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com> # s390
> 

Thanks for reviewing.

      reply	other threads:[~2021-05-24  9:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  4:35 [PATCH] mm/thp: Make ARCH_ENABLE_SPLIT_PMD_PTLOCK dependent on PGTABLE_LEVELS > 2 Anshuman Khandual
2021-05-10  8:53 ` Peter Zijlstra
2021-05-10 10:06   ` Anshuman Khandual
2021-05-10 10:10     ` Oscar Salvador
2021-05-10 10:16       ` Anshuman Khandual
2021-05-10 11:51         ` Anshuman Khandual
2021-05-17  4:15 ` Anshuman Khandual
2021-05-17 14:13   ` Gerald Schaefer
2021-05-19 11:07     ` Gerald Schaefer
2021-05-24  9:41       ` Anshuman Khandual [this message]

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=06299fb2-2f64-9094-3bf4-77045101ae22@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.