linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tianchen Ding <dtcccc@linux.alibaba.com>
To: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	kasan-dev@googlegroups.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] kfence: Alloc kfence_pool after system startup
Date: Mon, 7 Mar 2022 11:27:59 +0800	[thread overview]
Message-ID: <44ba7c68-d2a5-5bc1-b8e1-1a9dc6619369@linux.alibaba.com> (raw)
In-Reply-To: <fab45904-585b-0c59-a426-9ebecbd9d26f@linux.alibaba.com>

On 2022/3/7 10:23, Tianchen Ding wrote:
> On 2022/3/7 07:52, Marco Elver wrote:
>> On Sat, 5 Mar 2022 at 15:49, Tianchen Ding <dtcccc@linux.alibaba.com> 
>> wrote:
>> [...]
>>> +static int kfence_init_late(void)
>>> +{
>>> +       const unsigned long nr_pages = KFENCE_POOL_SIZE / PAGE_SIZE;
>>> +       struct page *pages;
>>> +
>>> +       pages = alloc_contig_pages(nr_pages, GFP_KERNEL, 
>>> first_online_node, NULL);
>>
>>> mm/kfence/core.c:836:17: error: implicit declaration of function 
>>> ‘alloc_contig_pages’ [-Werror=implicit-function-declaration]
>>
>> This doesn't build without CMA. See ifdef CONFIG_CONTIG_ALLOC in
>> gfp.h, which declares alloc_contig_pages.
>>
>> Will alloc_pages() work as you expect? If so, perhaps only use
>> alloc_contig_pages() #ifdef CONFIG_CONTIG_ALLOC.
>>
> 
> alloc_pages() will be fine. We could free "tail" pages after inited.
> Will send v3 soon.
> 

Oh, I remember why we use alloc_contig_pages()...
alloc_pages() (or alloc_pages_exact()) only support pages less than 
MAX_ORDER (default 11). The alloc would fail when KFENCE_NUM_OBJECTS >= 512.

So the design would be:
ifndef CONFIG_CONTIG_ALLOC and KFENCE_NUM_OBJECTS exceeds MAX_ORDER, we 
do not support alloc KFENCE pool after system startup.

>> Thanks,
>> -- Marco
> 



      reply	other threads:[~2022-03-07  3:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05 14:48 [PATCH v2 0/2] provide the flexibility to enable KFENCE Tianchen Ding
2022-03-05 14:48 ` [PATCH v2 1/2] kfence: Allow re-enabling KFENCE after system startup Tianchen Ding
2022-03-05 14:48 ` [PATCH v2 2/2] kfence: Alloc kfence_pool " Tianchen Ding
2022-03-06 23:52   ` Marco Elver
2022-03-07  2:23     ` Tianchen Ding
2022-03-07  3:27       ` Tianchen Ding [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=44ba7c68-d2a5-5bc1-b8e1-1a9dc6619369@linux.alibaba.com \
    --to=dtcccc@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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