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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E7D8C4332F for ; Tue, 8 Nov 2022 00:58:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EC0A6B0071; Mon, 7 Nov 2022 19:58:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 075A96B0073; Mon, 7 Nov 2022 19:58:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E59B58E0001; Mon, 7 Nov 2022 19:58:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D2B6B6B0071 for ; Mon, 7 Nov 2022 19:58:41 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id AC2161A1019 for ; Tue, 8 Nov 2022 00:58:41 +0000 (UTC) X-FDA: 80108464842.14.91F2169 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf23.hostedemail.com (Postfix) with ESMTP id 4F2CF140003 for ; Tue, 8 Nov 2022 00:58:41 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id o7so12340572pjj.1 for ; Mon, 07 Nov 2022 16:58:41 -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=ynlDtOUUghUPkZ/JEwzcIIickolGNMTCeVHYiiuGPX/80k9KubeCmuZI814cRER2bW AHvi9NHf0QV0QyO7ExCcBmpX4N0cF3p4qQUKxC7YhXxss+DmtYNVvaqejIDDe7gkL1G2 qsAye9JhOEm2VBEJtr5ihnBSIQ+9G7WYEZhvKIsvMXj99MphWSquiRKmOXV7z2n9HTuj w2oG40XvH5if9+/RpTfo6KvY7b+2Z/poop17XukTv9FrabQQsRBdE+gRf14YhRt2scuw 2hLG+jEGhUEjAxb1HoI+txHahIxEzvBU6U501Pl9ZZSCZ6lglzbanaSb0FW//kIAxIoe PBWw== X-Gm-Message-State: ACrzQf1cJKp9oNx3UtxlvD8l2nWYYUTL1Q78yy7iLgPznBKXS4GZOINQ Av/bkGg4LpZjmuB46ad0GlYdX2t0toRBnA== X-Google-Smtp-Source: AMsMyM6mBXg5PMqnQ7JzOldZSxkf7Q7kodUfnLZHCgQVvF9iOVj9puqqGr5N9Whvxfeyk9FFn0M/qA== 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667869121; a=rsa-sha256; cv=none; b=1VyJQ8BUniSXkp3i1AJf/yaHKhmwzlV56DoYYt/2HhCIQPf0jJuutZIkI/9hDs+Iqi9Oga 7BpBZqp22nnhroNFvS4hWHXh2bm4bBRQhvSMDLYA3WmIuB2Yn+UEUmcWYTujP/XrQjjW6u 5CqDiccp5TOQL2MUNYJqv/i400FJLwY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dnNam+nr; spf=pass (imf23.hostedemail.com: domain of zokeefe@google.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=zokeefe@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667869121; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Gubzl0YEUi8edKts0iVkW8bTbZEcmyzMNwtHakxV1DQ=; b=KVX5PNYoNlbqoSS2zwhFIOxD5M4NhAwaSUyNPCVg2H06hzygNiKrlYjUv9uW1ayYVHtq7V CTx0PkZG98UnLGsol99fQcpthlICwR23hHf+M5RQtTKEkT2kNVh6sl0BZQO771H8/+Fbiq F+hXalOVi3cAuYGFL1/A/QfQ3/2QVOo= Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dnNam+nr; spf=pass (imf23.hostedemail.com: domain of zokeefe@google.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=zokeefe@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4F2CF140003 X-Stat-Signature: wzpspyht96u83h96x81mzwhfr3b3sxag X-HE-Tag: 1667869121-772322 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 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