From: Zhenhua Huang <quic_zhenhuah@quicinc.com>
To: Marco Elver <elver@google.com>
Cc: <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_pkondeti@quicinc.com>, <quic_guptap@quicinc.com>,
<quic_tingweiz@quicinc.com>
Subject: Re: [PATCH v11] mm,kfence: decouple kfence from page granularity mapping judgement
Date: Fri, 17 Mar 2023 12:10:44 +0800 [thread overview]
Message-ID: <73f9140a-428c-14da-9695-dd0d39e0248e@quicinc.com> (raw)
In-Reply-To: <CANpmjNPeyEPOfk_OtxHzZhbJ30W1ik_arW4N1fKW6bpZwB0JCA@mail.gmail.com>
On 2023/3/17 5:43, Marco Elver wrote:
> On Thu, 16 Mar 2023 at 16:10, Zhenhua Huang <quic_zhenhuah@quicinc.com> wrote:
>>
>> Kfence only needs its pool to be mapped as page granularity, if it is
>> inited early. Previous judgement was a bit over protected. From [1], Mark
>> suggested to "just map the KFENCE region a page granularity". So I
>> decouple it from judgement and do page granularity mapping for kfence
>> pool only. Need to be noticed that late init of kfence pool still requires
>> page granularity mapping.
>>
>> Page granularity mapping in theory cost more(2M per 1GB) memory on arm64
>> platform. Like what I've tested on QEMU(emulated 1GB RAM) with
>> gki_defconfig, also turning off rodata protection:
>> Before:
>> [root@liebao ]# cat /proc/meminfo
>> MemTotal: 999484 kB
>> After:
>> [root@liebao ]# cat /proc/meminfo
>> MemTotal: 1001480 kB
>>
>> To implement this, also relocate the kfence pool allocation before the
>> linear mapping setting up, arm64_kfence_alloc_pool is to allocate phys
>> addr, __kfence_pool is to be set after linear mapping set up.
>>
>> LINK: [1] https://lore.kernel.org/linux-arm-kernel/Y+IsdrvDNILA59UN@FVFF77S0Q05N/
>> Suggested-by: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
>> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>
> Reviewed-by: Marco Elver <elver@google.com>
>
> One question: what happens if the page-granular direct map is
> requested either way, is there any downside with this patch? Does it
> mean map_mem() just does a little extra work it shouldn't have? (Not
> saying that's a problem, just trying to ask you to double-check it's
> ok.)
>
Yeah.. I think so Marco. Seems the extra work in map_mem() is we did
judgement there.. Other side is we added one early param.
> However, please also wait for an arm64 maintainer to have a look. I'm
> assuming that because it touches mostly arm64 code, this patch ought
> to go through the arm64 tree?
Yeah, sure. We will wait for arm64 maintainers' comments.
Thanks,
Zhenhua
>
> Thanks,
> -- Marco
prev parent reply other threads:[~2023-03-17 4:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 15:10 Zhenhua Huang
2023-03-16 21:43 ` Marco Elver
2023-03-17 4:10 ` Zhenhua Huang [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=73f9140a-428c-14da-9695-dd0d39e0248e@quicinc.com \
--to=quic_zhenhuah@quicinc.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dvyukov@google.com \
--cc=elver@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_guptap@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
--cc=quic_tingweiz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox