From: David Hildenbrand <david@redhat.com>
To: Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] x86/vmemmap: Drop handling of 1GB vmemmap ranges
Date: Wed, 3 Feb 2021 14:33:56 +0100 [thread overview]
Message-ID: <ec2f6a46-b2a8-8131-a2ac-48a02a1ea201@redhat.com> (raw)
In-Reply-To: <20210203104750.23405-3-osalvador@suse.de>
On 03.02.21 11:47, Oscar Salvador wrote:
> We never get to allocate 1GB pages when mapping the vmemmap range.
> Drop the dead code both for the aligned and unaligned cases and leave
> only the direct map handling.
>
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> Suggested-by: David Hildenbrand <david@redhat.com>
> ---
> arch/x86/mm/init_64.c | 31 ++++---------------------------
> 1 file changed, 4 insertions(+), 27 deletions(-)
>
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index b0e1d215c83e..28729c6b9775 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1062,7 +1062,6 @@ remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
> unsigned long next, pages = 0;
> pmd_t *pmd_base;
> pud_t *pud;
> - void *page_addr;
>
> pud = pud_start + pud_index(addr);
> for (; addr < end; addr = next, pud++) {
> @@ -1072,32 +1071,10 @@ remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
> continue;
>
> if (pud_large(*pud)) {
> - if (IS_ALIGNED(addr, PUD_SIZE) &&
> - IS_ALIGNED(next, PUD_SIZE)) {
> - if (!direct)
> - free_pagetable(pud_page(*pud),
> - get_order(PUD_SIZE));
> -
> - spin_lock(&init_mm.page_table_lock);
> - pud_clear(pud);
> - spin_unlock(&init_mm.page_table_lock);
> - pages++;
> - } else {
> - /* If here, we are freeing vmemmap pages. */
> - memset((void *)addr, PAGE_INUSE, next - addr);
> -
> - page_addr = page_address(pud_page(*pud));
> - if (!memchr_inv(page_addr, PAGE_INUSE,
> - PUD_SIZE)) {
> - free_pagetable(pud_page(*pud),
> - get_order(PUD_SIZE));
> -
> - spin_lock(&init_mm.page_table_lock);
> - pud_clear(pud);
> - spin_unlock(&init_mm.page_table_lock);
> - }
> - }
> -
> + spin_lock(&init_mm.page_table_lock);
> + pud_clear(pud);
> + spin_unlock(&init_mm.page_table_lock);
> + pages++;
> continue;
> }
One problem I see with existing code / this change making more obvious
is that when trying to remove in other granularity than we added (e.g.,
unplug a 128MB DIMM avaialble during boot), we remove the direct map of
unrelated DIMMs.
I think we should keep the
if (IS_ALIGNED(addr, PUD_SIZE) &&
IS_ALIGNED(next, PUD_SIZE)) {
...
}
bits. Thoguhts?
Apart from that looks good.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-02-03 13:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-03 10:47 [PATCH v2 0/3] Cleanup and fixups for vmemmap handling Oscar Salvador
2021-02-03 10:47 ` [PATCH v2 1/3] x86/vmemmap: Drop handling of 4K unaligned vmemmap range Oscar Salvador
2021-02-03 13:29 ` David Hildenbrand
2021-02-11 21:25 ` Oscar Salvador
2021-02-03 10:47 ` [PATCH v2 2/3] x86/vmemmap: Drop handling of 1GB vmemmap ranges Oscar Salvador
2021-02-03 13:33 ` David Hildenbrand [this message]
2021-02-03 14:10 ` Oscar Salvador
2021-02-03 14:12 ` David Hildenbrand
2021-02-03 14:15 ` Oscar Salvador
2021-02-03 10:47 ` [PATCH v2 3/3] x86/vmemmap: Handle unpopulated sub-pmd ranges Oscar Salvador
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=ec2f6a46-b2a8-8131-a2ac-48a02a1ea201@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mhocko@kernel.org \
--cc=mingo@redhat.com \
--cc=osalvador@suse.de \
--cc=peterz@infradead.org \
--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 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).