From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FEDBC433C1 for ; Wed, 31 Mar 2021 03:56:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10AEA619D6 for ; Wed, 31 Mar 2021 03:56:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10AEA619D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 579B46B007E; Tue, 30 Mar 2021 23:56:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 502BC6B0081; Tue, 30 Mar 2021 23:56:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37DD66B0082; Tue, 30 Mar 2021 23:56:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 18AA56B007E for ; Tue, 30 Mar 2021 23:56:04 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C45B38249980 for ; Wed, 31 Mar 2021 03:56:03 +0000 (UTC) X-FDA: 77978806206.20.288610C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id 2E220A000391 for ; Wed, 31 Mar 2021 03:56:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B7A08619C9; Wed, 31 Mar 2021 03:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617162962; bh=ljMJHCKTY/brMzUHBRt0hpZFr+FZzYQXin8Vwl3K2iY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i7PzESZpx3fS3ILnhJ40jkn2akou/X7RkZr0IggufQYbXDcCU6ubDll+Gs1phFsxp A1uKDIWJKkYkhQTFe2AcSLfvCXEM+AvPIQn16wCyrX5a9WkW/Lhc1n4zUh8gTcwN2B ayc+fDYW/B63QWdf8Zar0ZcYUFVmQxBg4c0zZ8d8vBmDBp8NScc/O76nzgS6mFt4o1 cZ7T1SXbFRgfCL3gMveK4L0CDw18wPFl/nePZMvuvBFdstjF2Px6NGcyGqmDHosjk3 fK1UUtsTFA0IhvX9McHaLSQfhUsXAB2JYCg4m9Ykq4q07uYM1QGhCuI2QihLvKF9lo k52w20eJUVKMw== Date: Wed, 31 Mar 2021 06:55:58 +0300 From: Leon Romanovsky To: Hyunsoon Kim Cc: Andrew Morton , 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 Message-ID: References: <1616995751-83180-1-git-send-email-h10.kim@samsung.com> <20210329101255.GA144155@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329101255.GA144155@ubuntu> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2E220A000391 X-Stat-Signature: 75jswuqsmuw78jjda8b3a6c9wqbuj4pf Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617162963-109190 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Mar 29, 2021 at 07:12:55PM +0900, Hyunsoon Kim wrote: > 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 > > > --- > > > 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. I'm more interested to see real results. Thanks > > Thanks