Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2253114rwb; Mon, 7 Nov 2022 11:00:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM7ny/e53/elr6djh+AemkB2FPNcbQO19B5V+NFZqEq4ghj0qfqwtfrKqCXRhiXcGpZZdsSj X-Received: by 2002:a05:6a00:1916:b0:56d:4c7e:7790 with SMTP id y22-20020a056a00191600b0056d4c7e7790mr44377453pfi.32.1667847616445; Mon, 07 Nov 2022 11:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667847616; cv=none; d=google.com; s=arc-20160816; b=NUVGz1Itibzw/C30FoHuN1ttC3eeGLUyMqrnVhYA7cd2qDf+87vpeDsB6zPDf5BqFe YJXmdRWYl9L8QeynVDnj9CSTt+Afa8i4cMBKjJAE+haX2IzbEZY5A0veuf3H3KknAOoH S7bEuNLK7fJ6y35G5N2OHrtprIXHgufqkggZUZzwJHe3H/dEtvpmvgwvVaCeJnEanCTQ rNlDC+cEW5xzecUMPp3oPR4jPk1/z0sgM+4n2IVypu3+/CqdQnI8X8Bl2JC+jnYRPVBI LjrY9izSbOxTfpny3l/AMl8kSzCfYWVQAJMOiuE4nkPxTwtmZKqm7w9ZUDROq7lrEyxL UNJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=b/mVKZ1bFQdlUizThgCTbRg+MO3jqWhYkRQgvO7dqeM=; b=ke3InLD+odesNq60O2y0F+tmOzkr17+SN17QYyttggjCoMweOvVzlWRWI6AjZrVLDL IkcXs6mtTuPijf3OEALFtWfgC1N7dSd/ZGklpfPlwqnzLTLpDfcVr6piMj2/aeUcAOuA xQImrXvypRcLDfw2wqjlv/LFN+0l8DiFMGOMLu95Rgk4rEvUs42KIhz2T9EqM3ZQg5pq ltPdwD8wuKzuG50iF3pYwrvO7xEtPya0FApBPQTWvms1BR35UmSidCGdYQwrWEGf+0KU fCkoVbIQyIp0v+TZEipEHnqQQOMXyB646ZFik9v41ooLsg8+tNO1joc5YCVsfn4XZwPl QB3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fbMozeF4; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 205-20020a6302d6000000b0047009247403si10091459pgc.409.2022.11.07.11.00.04; Mon, 07 Nov 2022 11:00:16 -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=@gmail.com header.s=20210112 header.b=fbMozeF4; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiKGSsR (ORCPT + 92 others); Mon, 7 Nov 2022 13:48:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbiKGSsP (ORCPT ); Mon, 7 Nov 2022 13:48:15 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E2825EB9 for ; Mon, 7 Nov 2022 10:48:14 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id d59-20020a17090a6f4100b00213202d77e1so15531881pjk.2 for ; Mon, 07 Nov 2022 10:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=b/mVKZ1bFQdlUizThgCTbRg+MO3jqWhYkRQgvO7dqeM=; b=fbMozeF4n5EHDWPz6r5hCdFs1Bw1rdu0oQVjqsl+Qtfjf2SBsbFrydgpV9aYcY7hw7 eEl/lyTd6zndxz13T3BNqFJ4Si79bxop0+YmvZixx/35134bxD289Aesbj5IRswQbFgP s/GFOweacw+IvYKfxGxXRvlMsjnQJyOrvWgKEaI3bbHXD7TTENZYLhcd/T/K/D6kk26+ MoGFfkA7851lcbQ9599QOEdb5TiKdf+x1ewjjxh9PwcKY24HevULCHg8FNxGsvSpSbJB J5pssEP0VFlfKIrgKAMMo9mAB+okQByv5z0LyhvDOX/lqTg3uupRuKaepEax/haUCpAi +MHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b/mVKZ1bFQdlUizThgCTbRg+MO3jqWhYkRQgvO7dqeM=; b=FYw8wA5h38ubOFKfrvJejeXB5yf9Mu0WJ6L540A8IWQvEiSGkrSrRjg2jd4LOyIphp r28zh+c/PnQQEXtO6G9uGfZ6A6Hw9tjMKJ2cUdY1XLc+g7Zq93DS1WDwAdXf7fG/LJiA 4+eq1ltG6yuqxlgASV35jEcKCxHjJUvfazx5OsWwl4OYr1YcLqM1LaGN81L11q3YaZwI UtLGvNu7dUNh9rfihpcvRm/ycFLpngmR0yeIvXxXvxb2fBsi0WRWfraxVNlKZ3QcKS4F PHq/AODabkSj4i3UxCNhcvpzGxmjaJimEZNBT0dcU5kCMuoc0jaaYtLbZ/iFSuMmugWT a8Rg== X-Gm-Message-State: ACrzQf08rRvoR6JHWyABnRTjiq5EVxs+GBVGelejhAr7ik3/J/4YnZ3H 17gOce87HCahXfyMalD17ifWW7gf+u70xvC9Z/Wm17sD X-Received: by 2002:a17:903:3291:b0:179:c436:4528 with SMTP id jh17-20020a170903329100b00179c4364528mr871743plb.102.1667846894287; Mon, 07 Nov 2022 10:48:14 -0800 (PST) MIME-Version: 1.0 References: <20221103213641.7296-1-shy828301@gmail.com> <20221103213641.7296-2-shy828301@gmail.com> In-Reply-To: From: Yang Shi Date: Mon, 7 Nov 2022 10:48:01 -0800 Message-ID: Subject: Re: [v2 PATCH 2/2] mm: don't warn if the node is offlined To: Michal Hocko Cc: zokeefe@google.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 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. > -- > Michal Hocko > SUSE Labs