Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2723515rwb; Mon, 7 Nov 2022 17:25:46 -0800 (PST) X-Google-Smtp-Source: AMsMyM5W4Srv4HNCJNkhjVYXW1GST7L1B5cyfa7rzymS0iALO94WobPz7UW5F2s2RoX8c+8tyqn9 X-Received: by 2002:a17:907:2c72:b0:7a4:a4b4:9fcb with SMTP id ib18-20020a1709072c7200b007a4a4b49fcbmr50709416ejc.403.1667870746092; Mon, 07 Nov 2022 17:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667870746; cv=none; d=google.com; s=arc-20160816; b=Rnb36DbPs2G+1OzW13nawt+gTR0EoUVqLwBxeb5hEfkRZkRYV5DZq6uTpiN3LQjxNI vMgySfwKERb1rFgFRjUSMONZYC7shHyE8T8Gs6Vz1Jx0Nmu0t72TNviX84of9ny3mwMu RFlJN2dt6c0NuUicvPCoxX3MX0/2AUUmA+HHlzafEwiEO6puH1h4sAsvdk89h3YixpjR 0e+o6PoH89leY/ERGsBtf7GcDGvPaQw2DrRZIJ0oPLutdVmxlptcRucCZ34rllcjzvHN tA5425CH5mtKFdB6iR6kCQ7c3kDYCDcaf6m9vbN/c+EVX7pg04k3ShlCsg9/LhGvqTC2 0Ujg== 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=Gubzl0YEUi8edKts0iVkW8bTbZEcmyzMNwtHakxV1DQ=; b=C2bhtse5Nb9zDRVlyXa4ldgpSIpn1nbqQPhyrA+69r9+x96IBQES2nM4sOwUwlROhG FV8+DSL7alDpGkpi6aF1d22n1t4H9uAZBfNhRSdndqYxbVQLozSr61PuG5TPkIDuh4uX tut58qe0Mvs6STjdmBzK74mJ9YZxrOjp3AYp09KMzB1c6n7M8hNuZiOIFeDmfjzeX2aF kXAg4dTF7gLLmBqDotOE7++XS8GXDp8l97KDWDngo3ZbP+bCnkY1YM9bceONLoFTPEje EI+m1fHEEpDs4rdO9F0+dWXzA/Dr9iyi10JX2bHx9HycVAyG4Ztd+YfrFlTkJanrCy0S t4wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dnNam+nr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho33-20020a1709070ea100b00782f3e3bb71si12728636ejc.912.2022.11.07.17.25.24; Mon, 07 Nov 2022 17:25:46 -0800 (PST) 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=@google.com header.s=20210112 header.b=dnNam+nr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233042AbiKHA6o (ORCPT + 91 others); Mon, 7 Nov 2022 19:58:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232850AbiKHA6l (ORCPT ); Mon, 7 Nov 2022 19:58:41 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE01712D1D for ; Mon, 7 Nov 2022 16:58:40 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id gw22so12331225pjb.3 for ; Mon, 07 Nov 2022 16:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Gubzl0YEUi8edKts0iVkW8bTbZEcmyzMNwtHakxV1DQ=; b=dnNam+nry5paMbo3UhYDeo/STVJh4H5BuTwjCI76NrtplJI7JqDyeEYROKEPqeT9oT ed0uXqiPoZnORUBfHIkxzM9Ldr4BsXz1AWtdU/mIcfNRD0MBaW47mMX9V6kqA5sZ4P2M YrnFIkRyJzi7yQf8D7ScxFGwCMHvLrtKqw16lutgdyO3GT34MCgL0ISHOFifBfy0/xzt 0xRO1VXi2rczB/9+Joe5Z0HQYpuikBW0qGt6GGBT8ZPGqzkvvB2AHEmEeWL/a46Y1RTp Ty/bRRE8F9LtETbB34IAZVnYqBhnTAr+GB2MctMnNAEzDGC2AvXZ1vJJP0VmoVYDtkUw Cydg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Gubzl0YEUi8edKts0iVkW8bTbZEcmyzMNwtHakxV1DQ=; b=aDS3I6N30kj9xnWDIe2F+ddgDW2BVg0pD4QqldNAOcogQTNeDEx88GujtBYpPLKeK1 qerqlZsV9zI33NbOYB5dgFCZ54RUTgzC8DECBqQ26SdRfThespY+B0/ZNpD3K1ghyxEp BJ4MaIsPOiggQoszxiugcQY88Ie2Ow8EeligFdXcCAYe4grL5gSMkSachIgAKCt+/T5D z15K0NT5zgHFh7KWecrix736x+RcDeETv/QGGoKCpVa5yl94FYDPb7aPYYkTshR37SGl qqDTmQmpZhnMtqFE4s2kXHUOZeD7TKvHNB2PYaepahGvNW1UwYsgXqjVN+xMqrBxbca1 yUYA== X-Gm-Message-State: ACrzQf2FIrSs7jCCJFDEjW8gqwv4LAxVtAPoCVnNJglOfIzDDjohoHIH PbXeA9SL5rtfaUTrs7AcKu0QBQ== X-Received: by 2002:a17:902:e352:b0:187:c4c:26ff with SMTP id p18-20020a170902e35200b001870c4c26ffmr50260985plc.162.1667869120007; Mon, 07 Nov 2022 16:58:40 -0800 (PST) Received: from google.com (33.5.83.34.bc.googleusercontent.com. [34.83.5.33]) by smtp.gmail.com with ESMTPSA id w10-20020a17090a460a00b00213202d77d9sm4882094pjg.43.2022.11.07.16.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 16:58:39 -0800 (PST) Date: Mon, 7 Nov 2022 16:58:36 -0800 From: Zach O'Keefe To: Yang Shi Cc: Michal Hocko , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH 2/2] mm: don't warn if the node is offlined Message-ID: References: <20221103213641.7296-1-shy828301@gmail.com> <20221103213641.7296-2-shy828301@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Nov 07 10:48, Yang Shi wrote: > On Sun, Nov 6, 2022 at 11:55 PM Michal Hocko wrote: > > > > On Fri 04-11-22 13:52:52, Yang Shi wrote: > > > On Fri, Nov 4, 2022 at 12:51 PM Michal Hocko wrote: > > > > > > > > On Fri 04-11-22 10:42:45, Yang Shi wrote: > > > > > On Fri, Nov 4, 2022 at 2:56 AM Michal Hocko wrote: > > > > > > > > > > > > On Fri 04-11-22 10:35:21, Michal Hocko wrote: > > > > > > [...] > > > > > > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > > > > > > > index ef4aea3b356e..308daafc4871 100644 > > > > > > > --- a/include/linux/gfp.h > > > > > > > +++ b/include/linux/gfp.h > > > > > > > @@ -227,7 +227,10 @@ static inline > > > > > > > struct folio *__folio_alloc_node(gfp_t gfp, unsigned int order, int nid) > > > > > > > { > > > > > > > VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); > > > > > > > - VM_WARN_ON((gfp & __GFP_THISNODE) && !node_online(nid)); > > > > > > > + if((gfp & __GFP_THISNODE) && !node_online(nid)) { > > > > > > > > > > > > or maybe even better > > > > > > if ((gfp & (__GFP_THISNODE|__GFP_NOWARN) == __GFP_THISNODE|__GFP_NOWARN) && !node_online(nid)) > > > > > > > > > > > > because it doesn't really make much sense to dump this information if > > > > > > the allocation failure is going to provide sufficient (and even more > > > > > > comprehensive) context for the failure. It looks more hairy but this can > > > > > > be hidden in a nice little helper shared between the two callers. > > > > > > > > > > Thanks a lot for the suggestion, printing warning if the gfp flag > > > > > allows sounds like a good idea to me. Will adopt it. But the check > > > > > should look like: > > > > > > > > > > if ((gfp & __GFP_THISNODE) && !(gfp & __GFP_NOWARN) && !node_online(nid)) > > > > > > > > The idea was to warn if __GFP_NOWARN _was_ specified. Otherwise we will > > > > get an allocation failure splat from the page allocator and there it > > > > will be clear that the node doesn't have any memory associated. It is > > > > exactly __GFP_NOWARN case that would be a silent failure and potentially > > > > a buggy code (like this THP collapse path). See my point? > > > > > > Aha, yeah, see your point now. I didn't see the splat from the > > > allocator from the bug report, then I realized it had not called into > > > allocator yet before the warning was triggered. > > > > And it would trigger even if it did because GFP_TRANSHUGE has > > __GFP_NOWARN > > Yeah, the syzbot has panic on warn set, so kernel just panicked before > entering the allocator. > Sorry I'm late to the party here. I think Michal's suggestion is sound -- catches instances like we saw with MADV_COLLAPSE, but no risk of panic-on-warn. Thanks for the suggestion. Best, Zach > > -- > > Michal Hocko > > SUSE Labs