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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 822E3C433C1 for ; Mon, 29 Mar 2021 10:25:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D645161920 for ; Mon, 29 Mar 2021 10:25:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D645161920 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2866E6B007D; Mon, 29 Mar 2021 06:25:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 236796B007E; Mon, 29 Mar 2021 06:25:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 089936B0080; Mon, 29 Mar 2021 06:25:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id E484D6B007D for ; Mon, 29 Mar 2021 06:25:38 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A437F180AD830 for ; Mon, 29 Mar 2021 10:25:38 +0000 (UTC) X-FDA: 77972530356.05.C14CD0E Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by imf07.hostedemail.com (Postfix) with ESMTP id BC02BA0009E2 for ; Mon, 29 Mar 2021 10:25:36 +0000 (UTC) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210329102534epoutp03ac8205c244229e3da25e25dd2ec7e031~wyT3vjeu71510115101epoutp03p for ; Mon, 29 Mar 2021 10:25:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210329102534epoutp03ac8205c244229e3da25e25dd2ec7e031~wyT3vjeu71510115101epoutp03p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1617013534; bh=fl2nppVzI3fXJpRHYjF+CyBv6FygMrQDwvcBv4SomCY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=u65VIUxVHFLCBdslZgWvTmKRmvLpwgx/TvXVpnj8Tr3Ug8kgrOqV5sMF8dtGKKBiG KBIaRTkZ4yeiuf35Yjs8PkW/mZpYEZyIXCazTEHuhCtCcE2TWIdpfebJouDXnzF31s RURNw2JhtMcwDzJHgWUl6v8HdZDIyDdWWfPhhH4Q= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20210329102533epcas2p161adbacdb15e8332a5aef8ed627fb5c9~wyT3IVkj_1708617086epcas2p1B; Mon, 29 Mar 2021 10:25:33 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.189]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4F87y32sDdz4x9Px; Mon, 29 Mar 2021 10:25:31 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id C8.7F.61506.B1BA1606; Mon, 29 Mar 2021 19:25:31 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20210329102530epcas2p11e5de4a40264b9aeca33c89a46932b82~wyT0j2TIH1487114871epcas2p1O; Mon, 29 Mar 2021 10:25:30 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210329102530epsmtrp23ef0be1a059da5b9a230dd48463f0e49~wyT0jPMgN1012210122epsmtrp2a; Mon, 29 Mar 2021 10:25:30 +0000 (GMT) X-AuditID: b6c32a46-e71ff7000000f042-15-6061ab1ba8d7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E1.F0.33967.A1BA1606; Mon, 29 Mar 2021 19:25:30 +0900 (KST) Received: from ubuntu (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210329102530epsmtip1b8660ec30e60bc2839a6687d353a89ff~wyT0Vz_1_2072320723epsmtip1J; Mon, 29 Mar 2021 10:25:30 +0000 (GMT) Date: Mon, 29 Mar 2021 19:12:55 +0900 From: Hyunsoon Kim To: Leon Romanovsky 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: <20210329101255.GA144155@ubuntu> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdljTTFd6dWKCQU+3kMWc9WvYLK5M+8No MeXXUmaLy7vmsFncW/Of1YHVY9OqTjaPTZ8msXucmPGbxaNvyypGj8+b5AJYo3JsMlITU1KL FFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0yc4CWKymUJeaUAoUCEouL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gFrrELMWRmVeSWpSXmKPExsWy7bCSnK7U6sQEg2WN8hZz1q9hs7gy7Q+j xZRfS5ktLu+aw2Zxb81/VgdWj02rOtk8Nn2axO5xYsZvFo++LasYPT5vkgtgjeKySUnNySxL LdK3S+DKOPT/GHNBt2DF9ovyDYyveLsYOTkkBEwkpp39xtTFyMUhJLCbUeLuw4OMEAlxiadL LkDZwhL3W46wQhQ9YpT4MrcZLMEioCqx9t9DMJtNQEPi9pSZ7CC2CFB85YK7rCA2s0C5xM/5 B5lBbGGBQInrXf9YQGxeAR2JQ+uPsUMM3cwoMfPIEzaIhKDEyZlPWCCatSRu/HsJdB4HkC0t sfwfB0iYU0BN4vbaj4wgYVEBFYlXB+snMArOQtI8C0nzLITmBYzMqxglUwuKc9Nziw0LDPNS y/WKE3OLS/PS9ZLzczcxgoNdS3MH4/ZVH/QOMTJxMB5ilOBgVhLhZT0dmyDEm5JYWZValB9f VJqTWnyIUZqDRUmc90LXyXghgfTEktTs1NSC1CKYLBMHp1QD0yKf82VzXK9PUfeW1e3U6mwq vMCj/2rdv4W/1m4xEmScf6A/dUvsWTnv4rc3VRcnSpSwP9h5d/dOD1WB+b4ckZXF73mPPa+X v2XhKHBo7kGFGAd+ybsFfoFBXxrj9fvasnfGl03O/d64XUvj94VjO9bbsXas38x4l+/qlut/ HXef5vh09//dqR0bylpS91rHv22Q4DSVCwz5u0xFh72yv1L84sriVWYbBVQYG37ef7ulTtqy 5Pdte5/Fi33SjM894DF68ER6R1B6sG5Guucq06OJj+0WBF1WjxUKfpbYUWJxnn2NDcuRKTMy KyPFREsVinp0d722qgy+dtDsdb32Z+GeS0ruSnmn9ONVg9mVWIozEg21mIuKEwFnIv8r5QIA AA== X-CMS-MailID: 20210329102530epcas2p11e5de4a40264b9aeca33c89a46932b82 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----gJqi5NNVyYI6Zwqm0SG9s49ZPiKtTbI8X5q.UcWq9Dw77Yu7=_23ab1_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210329054156epcas2p31650fa755e6cbcc55c4f33a79878256f References: <1616995751-83180-1-git-send-email-h10.kim@samsung.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: BC02BA0009E2 X-Stat-Signature: es7mcjmr8xqgptdnk8oh1qm9sm3fb3uf Received-SPF: none (samsung.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mailout3.samsung.com; client-ip=203.254.224.33 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617013536-74270 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: ------gJqi5NNVyYI6Zwqm0SG9s49ZPiKtTbI8X5q.UcWq9Dw77Yu7=_23ab1_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline 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. Thanks ------gJqi5NNVyYI6Zwqm0SG9s49ZPiKtTbI8X5q.UcWq9Dw77Yu7=_23ab1_ Content-Type: text/plain; charset="utf-8" ------gJqi5NNVyYI6Zwqm0SG9s49ZPiKtTbI8X5q.UcWq9Dw77Yu7=_23ab1_--