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 2852FC4321E for ; Fri, 4 Nov 2022 19:51:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63CB56B0071; Fri, 4 Nov 2022 15:51:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5ECB36B0073; Fri, 4 Nov 2022 15:51:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B4676B0074; Fri, 4 Nov 2022 15:51:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 39FF76B0071 for ; Fri, 4 Nov 2022 15:51:20 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 09F6BAB566 for ; Fri, 4 Nov 2022 19:51:20 +0000 (UTC) X-FDA: 80096803920.06.FF7C3D9 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf22.hostedemail.com (Postfix) with ESMTP id 75A55C000B for ; Fri, 4 Nov 2022 19:51:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DED1D218D6; Fri, 4 Nov 2022 19:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667591477; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gDOGeXrmX7icgkepYrjKYckzxUWHvShoiQ1nxpZt4oo=; b=XsYJJxK986TaTHkLjogC7lmW5zS9xLzwznfY0/W9rFMKLQc0if1VnwbzPFbrQNz0VjsLpC YoTWAJ7fnwmlqRNgg306W0xFR/2G8ADJjsg9rXzAZVTIDmrdBLPE24wvNZV3JgeD/eswfK Y2EBhHqG7zFNbf19qu6AqsltL9F/Qtg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BDA4913216; Fri, 4 Nov 2022 19:51:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uTrkKjVtZWOAWAAAMHmgww (envelope-from ); Fri, 04 Nov 2022 19:51:17 +0000 Date: Fri, 4 Nov 2022 20:51:17 +0100 From: Michal Hocko To: Yang Shi Cc: zokeefe@google.com, 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=1667591479; a=rsa-sha256; cv=none; b=5XzlW1qxuukdsFZQv2UyzE3hPCB5E8zEiMJ4e4H0fO76bewvHkAHVxkVp5cBC6HPYljYw/ v8ar9x4cOjc0+CMT585xxIRlh9SeY+f2x2HBfbcfCDG1uH5fdGYlg/zCdTj25XE5djk/0W jCMWWohw+A0AzfIEsBeO5d93kJq1tTE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=XsYJJxK9; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667591479; 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=gDOGeXrmX7icgkepYrjKYckzxUWHvShoiQ1nxpZt4oo=; b=x/wcXIqj57lK6q4dfKQv5mdMYIuThXsigtp0A4VYXamGDN/Pnxb4MpbQVN1/rzb4DOz7bH Ic21pRxD1hKl6ThL6wO2aT4fnqNKZjwt0EbDA8M0Lbt9fvVLVBB4abY+WZDglMUGRH/gsK FReaExd+e83bqzv22Ov2OnL6Y2ixNzM= X-Stat-Signature: utddd1pc5whrg5tyygddndfe19tteyg8 X-Rspamd-Queue-Id: 75A55C000B Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=XsYJJxK9; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1667591479-738643 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 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? -- Michal Hocko SUSE Labs