Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp5508rdh; Tue, 22 Aug 2023 10:52:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpTznbrEMomRJ8TGXNPCGmchiq9Ixm7GqS6CBezEoM54VywQw+fQBwWSL0LV4TWoL3u/XR X-Received: by 2002:a05:6512:3e19:b0:4fb:8435:3efc with SMTP id i25-20020a0565123e1900b004fb84353efcmr9405839lfv.16.1692726726187; Tue, 22 Aug 2023 10:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692726726; cv=none; d=google.com; s=arc-20160816; b=xG8F/bG+AJywSDvnPOfJMhvDsfs48mkLHF7607gYPgAS6OdpLIhauWFk2D/J5batGv ndMAfJSYh/VEI3qg3WJeavJEyZh2aECaGAQc8nHJ55NgsOBZuka1/rPAJt/mYqMk+5qz I7fww/Hu0YIKD+2/uxLB0tzGLCZX2cAhu/ONnwSSJoaldflw+R0JjeKMDUezH8o+z0rg CjP7fE8xbbm49dwtKMcwxFPXYpQsSfPViMD8RvVzcqx/pQFITuX+fzTdpLqMF9xbZgP8 qL3iljx6n6tW4LUYG+PqC+ED+8+vnEUCWmVCzmQ95y6Hz4W9FKHAoWjCPeyobwbT+bXa f30A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zannnmcY6SNoOkybwjeOtTke5144YyBTIEK2QwcEc+4=; fh=snz5eGY5sKSGKeLV7cliRE1IL4DTsxtC7iYZ0Ls9rIQ=; b=bOOsricxZdm75GTnDqmqxhsi11p7FHfE/9UiQJvBXplLlqDGTI+zb0oU2RMBjH5LIE 0U2oOOwjJRLGPPEJPWzc+YcbBqd6zaQajfu8aAwhbACgJDBC/xlMKpgoZbocfCSlDxKU uJGd3CkgJtvbDtO3C1Z+e8TKwE8uVTrO0Pkn7QmlYsxwyEjwAQ+l4QApIwHtmRmD3cOW GyZq4r5+kXoYna4m/pPgqEFNCQSqis/KB5qROmBIE5Vh6GUsyvkY/zQhGS/ZwMa/CIOF dAazqTsJhuwSKuAlD3QbYHNyWVbmp1LFU+MuNMfTAA4WuBMEvAEbghaIrj5SYZUelpGp 93qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j9FOx3XQ; 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 ot41-20020a170906cce900b009a16840d03fsi7368719ejb.433.2023.08.22.10.51.17; Tue, 22 Aug 2023 10:52:06 -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=j9FOx3XQ; 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 S229461AbjHVRs6 (ORCPT + 99 others); Tue, 22 Aug 2023 13:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjHVRs6 (ORCPT ); Tue, 22 Aug 2023 13:48:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB76196 for ; Tue, 22 Aug 2023 10:48:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5BA2F641CA for ; Tue, 22 Aug 2023 17:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2BD7C433CB for ; Tue, 22 Aug 2023 17:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692726535; bh=w9Vn+0wmdDc47W26xy7xzM3VjqdY3/VPTG/QkGXJykE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j9FOx3XQMJ09zN86UAzvfhihUMue6o2GbXPa+WG9RCiMiip//7Qw6kkVPAVFMx+of R3JyyYI0MZS+m9oX+Y5jRLDVqKrFqxhYJxLnvU2YALF5auAIz3J4rBHNj1bRJz2wXO 0lsLR+C7fCgMmkIwsrQJf87TspFuhCHmn1w6bo8MXV6VANWY5xQKxIEbXqqJ2BlUgD vnmwaWoHYf4RP0LElWkyfMhK5y2NnXmxLjd9f8XVbLaZqVMP2hz2drULNPVsHupb9Q GOj6KvnyoMyWfsny4BSOuuFhuSmVjFSI9s2zSxOluVytxCq8HJDfGYQWg59vgowXh4 nVkSBji5lpnpg== Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-5656a5c6721so2708032a12.1 for ; Tue, 22 Aug 2023 10:48:55 -0700 (PDT) X-Gm-Message-State: AOJu0YzB00B+ALd/k51YTl4MVjEsa1EZXKgJUc3DVux4ctQfxLHBJDvy QH7ykWCjSounPZxZP4Oo/79EsCQIhjazE6IU+hL6vA== X-Received: by 2002:a17:90a:ead0:b0:26b:13b7:22f9 with SMTP id ev16-20020a17090aead000b0026b13b722f9mr6574110pjb.22.1692726535057; Tue, 22 Aug 2023 10:48:55 -0700 (PDT) MIME-Version: 1.0 References: <20230817-free_pcppages_bulk-v1-0-c14574a9f80c@kernel.org> <20230821103225.qntnsotdzuthxn2y@techsingularity.net> In-Reply-To: <20230821103225.qntnsotdzuthxn2y@techsingularity.net> From: Chris Li Date: Tue, 22 Aug 2023 10:48:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard To: Mel Gorman Cc: Andrew Morton , Kemeng Shi , baolin.wang@linux.alibaba.com, Michal Hocko , david@redhat.com, willy@infradead.org, linux-mm@kvack.org, Namhyung Kim , Greg Thelen , linux-kernel@vger.kernel.org, John Sperbeck , Huang Ying , Alexei Starovoitov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Hi Mel, Adding Alexei to the discussion. On Mon, Aug 21, 2023 at 3:32=E2=80=AFAM Mel Gorman wrote: > > On Thu, Aug 17, 2023 at 11:05:22PM -0700, Chris Li wrote: > > In this patch series I want to safeguard > > the free_pcppage_bulk against change in the > > pcp->count outside of this function. e.g. > > by BPF program inject on the function tracepoint. > > > > I break up the patches into two seperate patches > > for the safeguard and clean up. > > > > Hopefully that is easier to review. > > > > Signed-off-by: Chris Li > > This sounds like a maintenance nightmare if internal state can be arbitra= ry > modified by a BPF program and still expected to work properly in all case= s. > Every review would have to take into account "what if a BPF script modifi= es > state behind our back?" Thanks for the feedback. I agree that it is hard to support if we allow BPF to change any internal stage as a rule. That is why it is a RFC. Would you consider it case by case basis? The kernel panic is bad, the first patch is actually very small. I can also change it to generate warnings if we detect the inconsistent state. How about the second (clean up) patch or Keming's clean up version? I can m= odify it to take out the pcp->count if the verdict is just not supporting BPF changing internal state at all. I do wish to get rid of the pindex_min and pindex_max. Thanks Chris