From: Marco Elver <elver@google.com>
To: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Cc: Pavan Kondeti <quic_pkondeti@quicinc.com>,
catalin.marinas@arm.com, will@kernel.org, glider@google.com,
dvyukov@google.com, akpm@linux-foundation.org,
robin.murphy@arm.com, mark.rutland@arm.com, jianyong.wu@arm.com,
james.morse@arm.com, wangkefeng.wang@huawei.com,
linux-arm-kernel@lists.infradead.org, kasan-dev@googlegroups.com,
linux-mm@kvack.org, quic_guptap@quicinc.com,
quic_tingweiz@quicinc.com, quic_charante@quicinc.com
Subject: Re: [PATCH v8] mm,kfence: decouple kfence from page granularity mapping judgement
Date: Wed, 15 Mar 2023 09:52:33 +0100 [thread overview]
Message-ID: <ZBGHUYJ2OY9Pz93U@elver.google.com> (raw)
In-Reply-To: <3253f502-aa2e-f8c9-b5bd-8eb20e5f6c5e@quicinc.com>
On Wed, Mar 15, 2023 at 02:51PM +0800, Zhenhua Huang wrote:
[...]
> > Is it possible to free this early allocated memory later in
> > mm_init()->kfence_alloc_pool()? if that is not possible, can we think of
> > adding early param for kfence?
>
> If we freed that buffer, there may be no chance to get that page granularity
> mapped buffer again.. as all these allocation/free are through normal buddy
> allocator.
>
> At this stage, seems only additional early param can work.. Marco previously
> wanted to reuse sample_interval but seems not doable now.
>
> Hi Marco,
>
> Sorry, Can we thought of the solution again? like
> ARM64:
> 1. intercepts early boot arg and gives early alloc memory to KFENCE
> 2. KFENCE to disable dynamic switch
> 3. disable page gran and save memory overhead
> The purpose is in the case of w/o boot arg, it's just same as now.. arch
> specific kfence buffer will not allocate. And w/ boot arg, we can get
> expected saving.
You can get kfence.sample_interval with early_param(). mm/kfence/core.c
should be left as is with a module param, so it can be set at runtime in
/sys/modules/kfence/parameters/.
However you can add this to the #ifdef CONFIG_KFENCE in arm64 code
you're adding:
static bool kfence_early_init __initdata = !!CONFIG_KFENCE_SAMPLE_INTERVAL;
static int __init parse_kfence_early_init(char *p) {
int val;
if (get_option(&p, &val))
kfence_early_init = !!val;
return 0;
}
early_param("kfence.sample_interval", parse_kfence_early_init);
Nothing is preventing us from parsing kfence.sample_interval twice
during boot. At this stage you don't need the actual sample_interval,
only if kfence.sample_interval was provided on the cmdline and is not 0.
That will avoid adding another new param.
Thanks,
-- Marco
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Marco Elver <elver@google.com>
To: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Cc: Pavan Kondeti <quic_pkondeti@quicinc.com>,
catalin.marinas@arm.com, will@kernel.org, glider@google.com,
dvyukov@google.com, akpm@linux-foundation.org,
robin.murphy@arm.com, mark.rutland@arm.com, jianyong.wu@arm.com,
james.morse@arm.com, wangkefeng.wang@huawei.com,
linux-arm-kernel@lists.infradead.org, kasan-dev@googlegroups.com,
linux-mm@kvack.org, quic_guptap@quicinc.com,
quic_tingweiz@quicinc.com, quic_charante@quicinc.com
Subject: Re: [PATCH v8] mm,kfence: decouple kfence from page granularity mapping judgement
Date: Wed, 15 Mar 2023 09:52:33 +0100 [thread overview]
Message-ID: <ZBGHUYJ2OY9Pz93U@elver.google.com> (raw)
In-Reply-To: <3253f502-aa2e-f8c9-b5bd-8eb20e5f6c5e@quicinc.com>
On Wed, Mar 15, 2023 at 02:51PM +0800, Zhenhua Huang wrote:
[...]
> > Is it possible to free this early allocated memory later in
> > mm_init()->kfence_alloc_pool()? if that is not possible, can we think of
> > adding early param for kfence?
>
> If we freed that buffer, there may be no chance to get that page granularity
> mapped buffer again.. as all these allocation/free are through normal buddy
> allocator.
>
> At this stage, seems only additional early param can work.. Marco previously
> wanted to reuse sample_interval but seems not doable now.
>
> Hi Marco,
>
> Sorry, Can we thought of the solution again? like
> ARM64:
> 1. intercepts early boot arg and gives early alloc memory to KFENCE
> 2. KFENCE to disable dynamic switch
> 3. disable page gran and save memory overhead
> The purpose is in the case of w/o boot arg, it's just same as now.. arch
> specific kfence buffer will not allocate. And w/ boot arg, we can get
> expected saving.
You can get kfence.sample_interval with early_param(). mm/kfence/core.c
should be left as is with a module param, so it can be set at runtime in
/sys/modules/kfence/parameters/.
However you can add this to the #ifdef CONFIG_KFENCE in arm64 code
you're adding:
static bool kfence_early_init __initdata = !!CONFIG_KFENCE_SAMPLE_INTERVAL;
static int __init parse_kfence_early_init(char *p) {
int val;
if (get_option(&p, &val))
kfence_early_init = !!val;
return 0;
}
early_param("kfence.sample_interval", parse_kfence_early_init);
Nothing is preventing us from parsing kfence.sample_interval twice
during boot. At this stage you don't need the actual sample_interval,
only if kfence.sample_interval was provided on the cmdline and is not 0.
That will avoid adding another new param.
Thanks,
-- Marco
next prev parent reply other threads:[~2023-03-15 8:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 7:05 [PATCH v8] mm,kfence: decouple kfence from page granularity mapping judgement Zhenhua Huang
2023-03-14 7:05 ` Zhenhua Huang
2023-03-14 8:36 ` Pavan Kondeti
2023-03-14 10:08 ` Zhenhua Huang
2023-03-14 11:14 ` Pavan Kondeti
2023-03-14 11:14 ` Pavan Kondeti
2023-03-15 6:51 ` Zhenhua Huang
2023-03-15 6:51 ` Zhenhua Huang
2023-03-15 8:52 ` Marco Elver [this message]
2023-03-15 8:52 ` Marco Elver
2023-03-15 11:19 ` Zhenhua Huang
2023-03-15 11:19 ` Zhenhua Huang
2023-03-14 11:20 ` Zhenhua Huang
2023-03-14 11:20 ` Zhenhua Huang
2023-03-14 8:41 ` Marco Elver
2023-03-14 10:31 ` Zhenhua Huang
2023-03-14 10:31 ` Zhenhua Huang
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=ZBGHUYJ2OY9Pz93U@elver.google.com \
--to=elver@google.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=james.morse@arm.com \
--cc=jianyong.wu@arm.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=quic_charante@quicinc.com \
--cc=quic_guptap@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
--cc=quic_tingweiz@quicinc.com \
--cc=quic_zhenhuah@quicinc.com \
--cc=robin.murphy@arm.com \
--cc=wangkefeng.wang@huawei.com \
--cc=will@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.