Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1930548rdb; Tue, 5 Sep 2023 09:06:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjDIzHLj980HQBFIaVCX3Q490nt1clIcWciTLskWCIjfPNB9Z+dqFKzRuKSwJQbLw3onSe X-Received: by 2002:aa7:d385:0:b0:52c:164:efe4 with SMTP id x5-20020aa7d385000000b0052c0164efe4mr219508edq.34.1693929991124; Tue, 05 Sep 2023 09:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693929991; cv=none; d=google.com; s=arc-20160816; b=QQuGgqDH4stBy1J1xpFplY8SV7/2ktLn8QyeX/ewhQXEWK9KLDRqDsORn5BYhcMI64 Yf9kPzeYeqotPUnN7K60NNnpKUjO9tln5bZj+U1h6D0qXmypJ/t2Fl7fD1fC69Hle+28 +m9kzk9c99HJS8wKbhbh/n5MSUDjcCQ+mGFTxmQHcykDqmVFJVLn70A6JylPVdzg6Ovr EWi2+ziXmP2enR1WtyuU72OC2bfrVIeKXdbhrBnu1S01OIKX8sDTs3hkiHwRdMUxl/uG vW4l6auJ8uquSoBcRl+sLeCon43QCTlDdNDi7EXTEFYTYmpGCqkhPuSLA8u5xwQuGeLe Rv1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O8BeYj9B0PIcsKjPSsv3IHIjCjB1iQCxHiPL3YgLFn4=; fh=4RFwTTVM9N+ZnfbmbaF2VFhJ7yC5qHE1YP3dBpdMwcI=; b=LEMjEYJiWvs9GAxWYuXw4zPvoz3aXQ/DxtKjsW7VO0PrceGJGe6Ms1bsw7NDRZ5Z4R e+GfpAU1WwNE6oj7B011WwUf6AwYbopGjv5ZEUcTd6qBv+JD1G7WK6+f6PJkW5gXSMSW BIZuubZh/rBU4HfNr7a5BUDzf9HOmKtTdUSX1u6s7fECtNtrlGOgHfVfHG4izbAB/5FW uaHANQKjsVzD0Mcr5VJpAIWTCsPoca0n850kUCbYKWHWO5GCqTl0iFB+nmFWzsHI9N1+ g2Dlj5mgeadoIZzliR/Z3bpwdSGs8nUgoZsKikMH0ptBj6g8vZKQHhzz9ekM7I4S4MfA txDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AS8b2VTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020aa7c486000000b00525665e8c36si8001359edq.430.2023.09.05.09.06.24; Tue, 05 Sep 2023 09:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AS8b2VTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241466AbjIDSWq (ORCPT + 21 others); Mon, 4 Sep 2023 14:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236547AbjIDSWo (ORCPT ); Mon, 4 Sep 2023 14:22:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 166A213E for ; Mon, 4 Sep 2023 11:22:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E2604CE0E30 for ; Mon, 4 Sep 2023 18:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A23D0C433C7; Mon, 4 Sep 2023 18:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693851756; bh=plSadGikF5SVB6fcGNEoFCniaaqZVESV2r2w8EO8OLY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AS8b2VTuL1498D+vCpK6FGEStRPcO0ZZGAldikbShf2FjQodPosI8qTcReUdxEqo9 vpnBmg1fcoKlXEjpNhe+lKB0Y7XISjNs0vd+I7UWq4WgOUdvIVg7WqKFC4E0llbCso v26MxNCM+R/WC0VxyiAxOyMsmAbaZAJYG0zFGoL6B5GvTgybZ26fPQabTbplckcpVs mC7IOobtcb1u0jbZZulbQqU5evOVbl2x+VBsaMhioEH7gAuqmt0NqS+aJg2JjyRzwe h3jg5neiEN3VVWh6V87hYYdnN1nguT/cJPed0O0U5WFXQouFhsSSCg1XSkMysGQV33 4M9X0m/xSsF1g== Date: Mon, 4 Sep 2023 11:22:34 -0700 From: Eric Biggers To: Linus Torvalds Cc: Michal Hocko , Alexander Potapenko , Zhaoyang Huang , Matthew Wilcox , "zhaoyang.huang" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ke.wang@unisoc.com, Marco Elver , Dmitry Vyukov , Dave Hansen , Kees Cook , Mateusz Guzik , Al Viro Subject: Re: [PATCH] mm: make __GFP_SKIP_ZERO visible to skip zero operation Message-ID: <20230904182234.GB30774@sol.localdomain> References: <20230831105252.1385911-1-zhaoyang.huang@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 04, 2023 at 10:34:25AM -0700, Linus Torvalds wrote: > On Mon, 4 Sept 2023 at 00:55, Michal Hocko wrote: > > > > Sooner or later this will become an > > unreviewable mess so the value of init_on_alloc will become very > > dubious. > > The value of init_on_alloc is *already* very dubious. > > Exactly because people will turn it off, because it hurts performance > so much - and in pointless ways. > > You do realize that distributions - well, at least Fedora - simply > don't turn INIT_ON_ALLOC_DEFAULT_ON on at all? > > So the current state of init_on_alloc is that nobody sane uses it. You > have to think you're special to enable it, because it is *so* bad. > > Security people need to realize that the primary point of computing is > NEVER EVER security. Security is entirely pointless without a usable > system. > > Unless security people realize that they are always secondary, they > aren't security people, they are just random wankers. > > And people who state this truism had better not get shamed for > standing up to stupidity. > Android and Ubuntu both set CONFIG_INIT_ON_ALLOC_DEFAULT_ON. I think this makes it clear that the init-on-alloc feature is useful for a substantial amount of users even in its current form. I would caution against checking the kernel config for the distro you happen to be using and extrapolating that to all Linux systems. Regardless, I'm in favor of a per allocation opt-out flag like GFP_SKIP_ZERO. There are clear cases where it makes sense, for example some places in the VFS where the performance impact is large and the code has been carefully reviewed. I don't really like the idea (https://lore.kernel.org/lkml/CAG_fn=UQEuvJ9WXou_sW3moHcVQZJ9NvJ5McNcsYE8xw_WEYGw@mail.gmail.com/) of making the system administrator have to opt out allocation sites individually via a kernel command-line parameter. Yes, it makes the opt out less likely to be abused as two parties (developer and system administrator) have to consent to each individual opt out. So it theory it sounds good. But I feel that doesn't outweigh the fact that it would be complicated and hard to use. How about just having two options: one to always honor GFP_SKIP_ZERO in the code and one to always ignore it. - Eric