From: Nicholas Piggin <npiggin@gmail.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
linux-mm@kvack.org, Russell Currey <ruscur@russell.cc>
Cc: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 4/4] mm/vmalloc: Hugepage vmalloc mappings
Date: Wed, 19 Jun 2019 13:39:19 +1000 [thread overview]
Message-ID: <1560915223.if2qg1yc7k.astroid@bobo.none> (raw)
In-Reply-To: <b79bf11d-43c7-88c9-8395-239625a1bdcf@c-s.fr>
Christophe Leroy's on June 11, 2019 3:39 pm:
>
>
> Le 10/06/2019 à 06:38, Nicholas Piggin a écrit :
>> For platforms that define HAVE_ARCH_HUGE_VMAP, have vmap allow vmalloc to
>> allocate huge pages and map them
>
> Will this be compatible with Russell's series
> https://patchwork.ozlabs.org/patch/1099857/ for the implementation of
> STRICT_MODULE_RWX ?
> I see that apply_to_page_range() have things like BUG_ON(pud_huge(*pud));
>
> Might also be an issue for arm64 as I think Russell's implementation
> comes from there.
Yeah you're right (and correct about arm64 problem). I'll fix that up.
>> +static int vmap_hpages_range(unsigned long start, unsigned long end,
>> + pgprot_t prot, struct page **pages,
>> + unsigned int page_shift)
>> +{
>> + BUG_ON(page_shift != PAGE_SIZE);
>
> Do we really need a BUG_ON() there ? What happens if this condition is
> true ?
If it's true then vmap_pages_range would die horribly reading off the
end of the pages array thinking they are struct page pointers.
I guess it could return failure.
>> + return vmap_pages_range(start, end, prot, pages);
>> +}
>> +#endif
>> +
>> +
>> int is_vmalloc_or_module_addr(const void *x)
>> {
>> /*
>> @@ -462,7 +498,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
>> {
>> unsigned long addr = (unsigned long) vmalloc_addr;
>> struct page *page = NULL;
>> - pgd_t *pgd = pgd_offset_k(addr);
>> + pgd_t *pgd;
>> p4d_t *p4d;
>> pud_t *pud;
>> pmd_t *pmd;
>> @@ -474,27 +510,38 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
>> */
>> VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr));
>>
>> + pgd = pgd_offset_k(addr);
>> if (pgd_none(*pgd))
>> return NULL;
>> +
>> p4d = p4d_offset(pgd, addr);
>> if (p4d_none(*p4d))
>> return NULL;
>> - pud = pud_offset(p4d, addr);
>> +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
>
> Do we really need that ifdef ? Won't p4d_large() always return 0 when is
> not set ?
> Otherwise, could we use IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP) instead ?
>
> Same several places below.
Possibly some of them are not defined without HAVE_ARCH_HUGE_VMAP
I think. I'll try to apply this pattern as much as possible.
>> @@ -2541,14 +2590,17 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>> pgprot_t prot, int node)
>> {
>> struct page **pages;
>> + unsigned long addr = (unsigned long)area->addr;
>> + unsigned long size = get_vm_area_size(area);
>> + unsigned int page_shift = area->page_shift;
>> + unsigned int shift = page_shift + PAGE_SHIFT;
>> unsigned int nr_pages, array_size, i;
>> const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
>> const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN;
>> const gfp_t highmem_mask = (gfp_mask & (GFP_DMA | GFP_DMA32)) ?
>> - 0 :
>> - __GFP_HIGHMEM;
>> + 0 : __GFP_HIGHMEM;
>
> This patch is already quite big, shouldn't this kind of unrelated
> cleanups be in another patch ?
Okay, 2 against 1. I'll minimise changes like this.
Thanks,
Nick
next prev parent reply other threads:[~2019-06-19 3:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 4:38 [PATCH 1/4] mm: Move ioremap page table mapping function to mm/ Nicholas Piggin
2019-06-10 4:38 ` [PATCH 2/4] arm64: support huge vmap vmalloc Nicholas Piggin
2019-06-10 5:47 ` Anshuman Khandual
2019-06-10 6:14 ` Nicholas Piggin
2019-06-10 4:38 ` [PATCH 3/4] powerpc/64s/radix: " Nicholas Piggin
2019-06-10 4:38 ` [PATCH 4/4] mm/vmalloc: Hugepage vmalloc mappings Nicholas Piggin
2019-06-10 5:49 ` Nicholas Piggin
2019-06-10 8:08 ` Satheesh Rajendran
2019-06-10 8:53 ` Anshuman Khandual
2019-06-11 0:16 ` Nicholas Piggin
2019-06-11 6:59 ` Anshuman Khandual
2019-06-19 3:29 ` Nicholas Piggin
2019-06-10 14:10 ` Mark Rutland
2019-06-10 14:44 ` Nicholas Piggin
2019-06-11 6:17 ` Anshuman Khandual
2019-06-19 3:33 ` Nicholas Piggin
2019-06-11 5:39 ` Christophe Leroy
2019-06-19 3:39 ` Nicholas Piggin [this message]
2019-06-10 5:42 ` [PATCH 1/4] mm: Move ioremap page table mapping function to mm/ Anshuman Khandual
2019-06-10 6:21 ` Nicholas Piggin
2019-06-11 5:24 ` Christophe Leroy
2019-06-19 3:43 ` Nicholas Piggin
2019-06-19 13:18 ` Christophe Leroy
2019-06-22 9:42 ` Nicholas Piggin
-- strict thread matches above, loose matches on Subject: below --
2019-05-28 12:04 [PATCH 1/4] mm/large system hash: use vmalloc for size > MAX_ORDER when !hashdist Nicholas Piggin
2019-05-28 12:04 ` [PATCH 4/4] mm/vmalloc: Hugepage vmalloc mappings Nicholas Piggin
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=1560915223.if2qg1yc7k.astroid@bobo.none \
--to=npiggin@gmail.com \
--cc=christophe.leroy@c-s.fr \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ruscur@russell.cc \
/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