From: Hyunsoon Kim <h10.kim@samsung.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
dseok.yi@samsung.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: add ___GFP_NOINIT flag which disables zeroing on alloc
Date: Mon, 29 Mar 2021 19:12:55 +0900 [thread overview]
Message-ID: <20210329101255.GA144155@ubuntu> (raw)
In-Reply-To: <YGF09yYtxeNj4Bcc@unreal>
[-- Attachment #1: Type: text/plain, Size: 2144 bytes --]
On Mon, Mar 29, 2021 at 09:34:31AM +0300, Leon Romanovsky wrote:
> On Mon, Mar 29, 2021 at 02:29:10PM +0900, Hyunsoon Kim wrote:
> > This patch allows programmer to avoid zero initialization on page
> > allocation even when the kernel config "CONFIG_INIT_ON_ALLOC_DEFAULT"
> > is enabled. The configuration is made to prevent uninitialized
> > heap memory flaws, and Android has applied this for security and
> > deterministic execution times. Please refer to below.
> >
> > https://android-review.googlesource.com/c/kernel/common/+/1235132
> >
> > However, there is a case that the zeroing page memory is unnecessary
> > when the page is used on specific purpose and will be zeroed
> > automatically by hardware that accesses the memory through DMA.
> > For instance, page allocation used for IP packet reception from Exynos
> > modem is solely used for packet reception. Although the page will be
> > freed eventually and reused for some other purpose, initialization at
> > that moment of reuse will be sufficient to avoid uninitialized heap
> > memory flaws. To support this kind of control, this patch creates new
> > gfp type called ___GFP_NOINIT, that allows no zeroing at the moment
> > of page allocation, called by many related APIs such as page_frag_alloc,
> > alloc_pages, etc.
> >
> > Signed-off-by: Hyunsoon Kim <h10.kim@samsung.com>
> > ---
> > include/linux/gfp.h | 2 ++
> > include/linux/mm.h | 4 +++-
> > 2 files changed, 5 insertions(+), 1 deletion(-)
>
> Let's assume that we will use this new flag, and users are smart enough
> to figure when it needs to be used, what will be the performance gain?
>
> Thanks
For instance, there are four memory access (either read or write) done
by the system; memory write due to page allocation for reserving memory
for modem hardware, memory write on the page by modem hardware,
read and write incurred by copy_to_user operation by iperf reading
the incoming network data. Theoretically, we can expect 1/4 of power
saving on DRAM bandwidth. By performing simple iperf test with download
UDP 800Mbps, we saw 5-6mA power gain by disabling
CONFIG_INIT_ON_ALLOC_DEFAULT.
Thanks
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2021-03-29 10:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210329054156epcas2p31650fa755e6cbcc55c4f33a79878256f@epcas2p3.samsung.com>
2021-03-29 5:29 ` [PATCH] mm: add ___GFP_NOINIT flag which disables zeroing on alloc Hyunsoon Kim
2021-03-29 6:34 ` Leon Romanovsky
2021-03-29 10:12 ` Hyunsoon Kim [this message]
2021-03-31 3:55 ` Leon Romanovsky
2021-03-29 9:47 ` kernel test robot
2021-03-29 10:53 ` David Hildenbrand
2021-03-30 1:44 ` Hyunsoon Kim
2021-03-30 8:52 ` 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=20210329101255.GA144155@ubuntu \
--to=h10.kim@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=dseok.yi@samsung.com \
--cc=leon@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).