linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ping Fang <pifang@redhat.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Roman Gushchin <guro@fb.com>, Michal Hocko <mhocko@suse.com>,
	 Oscar Salvador <osalvador@suse.de>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH v1] mm/vmalloc: fix exact allocations with an alignment > 1
Date: Wed, 29 Sep 2021 18:08:26 +0200	[thread overview]
Message-ID: <CA+KHdyVC1KCP2r2st_TmfmXaPZ49ym0gyN31CwLZfE=ipLGjmA@mail.gmail.com> (raw)
In-Reply-To: <689b7c24-623d-c01e-6c0f-ad430f1fa3ae@redhat.com>

> > Could you please to be more specific? I mean how is it connected with huge
> > pages mappings? Huge-pages are which have order > 0. Or you mean that
> > a special alignments are needed for mapping huge pages?
>
> Let me try to clarify:
>
>
> KASAN does an exact allocation when onlining a memory block,
> __vmalloc_node_range() will try placing huge pages first, increasing the
> alignment to e.g., "1 << PMD_SHIFT".
>
> If we increase the search length in find_vmap_lowest_match(), that
> search will fail if the exact allocation is surrounded by other
> allocations. In that case, we won't place a huge page although we could
> -- because find_vmap_lowest_match() would be imprecise for alignments >
> PAGE_SIZE.
>
>
> Memory blocks we online/offline on x86 are at least 128MB. The KASAN
> "overhead" we have to allocate is 1/8 of that -- 16 MB, so essentially 8
> huge pages.
>
> __vmalloc_node_range() will increase the alignment to 2MB to try placing
> huge pages first. find_vmap_lowest_match() will search within the given
> exact 16MB are a 18MB area (size + align), which won't work. So
> __vmalloc_node_range() will fallback to the original PAGE_SIZE alignment
> and shift=PAGE_SHIFT.
>
> __vmalloc_area_node() will set the set_vm_area_page_order effectively to
> 0 --  small pages.
>
> Does that make sense or am I missing something?
>
Thank you for clarification. OK, we come back anyway to the "problem" with fixed
range and an exact allocation plus a special alignment > PAGE_SIZE. Thus the
KASAN will not make use of huge pages mappings and go with regular instead
as a fallback path. But we would like to utilize huge-mappings for KASAN.

I will send the patch you tested and add your "tested-by" tag. Does it
sound good?

--
Uladzislau Rezki


  reply	other threads:[~2021-09-29 16:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 13:27 [PATCH v1] mm/vmalloc: fix exact allocations with an alignment > 1 David Hildenbrand
2021-09-13  8:29 ` Uladzislau Rezki
2021-09-13  8:44 ` Uladzislau Rezki
2021-09-14 19:15   ` Uladzislau Rezki
2021-09-15  9:02     ` David Hildenbrand
2021-09-16 19:34       ` Uladzislau Rezki
2021-09-17  8:47         ` David Hildenbrand
2021-09-21 22:13           ` Uladzislau Rezki
2021-09-22  8:34             ` David Hildenbrand
2021-09-22 10:41               ` Uladzislau Rezki
2021-09-23 17:42                 ` David Hildenbrand
2021-09-24 12:42                 ` David Hildenbrand
2021-09-29 14:30                   ` Uladzislau Rezki
2021-09-29 14:40                     ` David Hildenbrand
2021-09-29 14:49                       ` Uladzislau Rezki
2021-09-29 15:05                         ` David Hildenbrand
2021-09-29 16:08                           ` Uladzislau Rezki [this message]
2021-09-29 16:10                             ` 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='CA+KHdyVC1KCP2r2st_TmfmXaPZ49ym0gyN31CwLZfE=ipLGjmA@mail.gmail.com' \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=guro@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pifang@redhat.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;
as well as URLs for NNTP newsgroup(s).