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.2 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 718BCC433C1 for ; Mon, 29 Mar 2021 06:34:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 003CE6192B for ; Mon, 29 Mar 2021 06:34:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 003CE6192B 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 785CF6B0074; Mon, 29 Mar 2021 02:34:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 732646B0075; Mon, 29 Mar 2021 02:34:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E0756B0078; Mon, 29 Mar 2021 02:34:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id 3BFA46B0074 for ; Mon, 29 Mar 2021 02:34:38 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E6A8C8249980 for ; Mon, 29 Mar 2021 06:34:37 +0000 (UTC) X-FDA: 77971948194.28.D1F6DBB Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf03.hostedemail.com (Postfix) with ESMTP id DAF76C0007C4 for ; Mon, 29 Mar 2021 06:34:35 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 377056192B; Mon, 29 Mar 2021 06:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616999675; bh=pG64FB9rWovZQplGtwnKbEowT24yQaVuAwZw82YgEGU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rMxe+QBYAVmedAAlAj9m7ayc0pQrClYyyMyDUnn5p7vuHDudjo4ivpJFWZ6/jnjuy uhwTy8+kP1qCW/ekLsRlwWr/zO7IF2dgCpVtAvpbh+wfpoRqntC/DAR+6t+Tl5Z4CN cdYT7WImi5szh693yk9loi3udsqdQ3IAG3DnE45GI7tO+YaBwEh9bg2IVzPjoa4jnB lVvRSDImw3yJNDbxg5193wcV1rW+B657WpiOrPNwNs6zCl/1sd8bIfW3eakuF3MJLb 2sd/YKaUlios5/zL0Lv1JyisqEUSt2NA2+6DGnjmEpbYYrG0rEBTUlqVpNXM0IqyBI NYkB4mWjrRcng== Date: Mon, 29 Mar 2021 09:34:31 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1616995751-83180-1-git-send-email-h10.kim@samsung.com> X-Rspamd-Queue-Id: DAF76C0007C4 X-Stat-Signature: soh1mbgr8kbde1okkrhdtcdjx87ffdq9 X-Rspamd-Server: rspam02 Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616999675-19831 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 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