Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7929513imu; Mon, 3 Dec 2018 23:17:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/UW0bPyseJmGclL9v9moReHfTzvScesJPh7CIfpOQ+htGiDDpUDSXxZ1gL2MeMzryuIR4BR X-Received: by 2002:a63:101:: with SMTP id 1mr15920588pgb.152.1543907865295; Mon, 03 Dec 2018 23:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543907865; cv=none; d=google.com; s=arc-20160816; b=ej2JncgLEMwBVgS2G9Xu1Oe7NVub08ff9VMw3U46p0xVwf8e9i6D1AFFy40su7uQII /Z+zlkxvf2Cp7GN/GIt3PicZUSAfi/OvJKb1ny/AthOISPyYcWGDieX/QHHWaPK+viRT 7WVk/O5wJum3rRtIInZvgebhTVNgkXNZ5zFEKbWBxRVrz/OV4fjSLhCSgw1sXdu2dWSp y7Kbt9PjfRw70c5SKjA6s0Fy8lKwFRfBWpymbuub/v/6xyeJZuA8qEGPeCZp0t1T7eMA Zisko34219EvYVvpATdsuPebxTQ81rmI/83dnSywLGozsEA3EElwN8w8r6n9uj7LNpHD fkyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=l60/TJR3YhfpFyt1x2HOf7fUKk4/P6UR/hSTbtnruvo=; b=JJBCtdlfu+o/+k1EO7e4kAZ7aWT9ne8dpIanFhAinjXNL0R44ChCWMNPqShUVN7zlK jtNoh1xVaBFjbrQVDxCcaZqfRIHmrOEjZ4V2gOmOpoboSDbI32q4cWaX1/OgT3PV15G4 cRGvbDq2evB18Rz4gb3wznXlA3r+u6Kodd0pub64/aIGJAEyik9PYIDLYbAwzZU+U63u 37NCofC3GJ/usjDMQQJ3nxpIyDWZlAe2zEIghHdx2/dud7eMOxYN8Hmg+BxWawUnHm66 XLKUAQMCLOeW9Rn1eOiiMQlqgWNtxrfdNtWdSkCWDe1CwBstYNO2efBTfzpd1QFt99G0 pOLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ScH82CyU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si17234188plc.110.2018.12.03.23.17.30; Mon, 03 Dec 2018 23:17:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ScH82CyU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726052AbeLDHQw (ORCPT + 99 others); Tue, 4 Dec 2018 02:16:52 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40641 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbeLDHQw (ORCPT ); Tue, 4 Dec 2018 02:16:52 -0500 Received: by mail-ed1-f67.google.com with SMTP id d3so12975724edx.7 for ; Mon, 03 Dec 2018 23:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=l60/TJR3YhfpFyt1x2HOf7fUKk4/P6UR/hSTbtnruvo=; b=ScH82CyU/xoG9RlIlXFOdetUayFdING8Mh6fwggPFYvaRoPNs3bhDf6HfpuvjIBBDJ 4XcysOs//n9M9ro9Lw8qTSTmy9IezIGK0AQTsjZBErPK49zKmmQfNUPUYy9ecyaRLLSz SCFdGgsvUmvSOiH1yY/6EcIlyYvPa1HCQ/poPEJ3CrFBN3vUwqtrmtp3zdZxCBeCNkm6 VYedFjsrOQL+Cqeasu+DS7Kmm97iyyem0X7QdQ8oS5+fz4GAncmdwPoQtLAqOamWETZh WKktqVEX43yuuokkmcbu0Brus5Rn2U0VkwAkG3/jywqDQAbdUsirjgScPLf37kZ+42RO 98oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l60/TJR3YhfpFyt1x2HOf7fUKk4/P6UR/hSTbtnruvo=; b=fzhp14f1ge4JYFt3sLm36SYipaTO3dBCLLbrcrVWum7pvlKMNNNJF+/3f497wSUonb AXNzx9vmx46/zYZqHZJSG5QF43AHs4zDSrSgugE1pCPK10h0yl4ZNfXwvdbY5e2a2d2Z PU3WNDmkurdFYvQCsHQAqj4ldDrdDu2ay+T5cqGgjuMY6/ehnFUgpeaU62xDi35xojxR QYjc04WNSOKfUDY5UO3ct5LsZf67bTcjUofSl3d8nvpKOnMIH1iOoywhhhCg2EVyqFrn fMqNFJluzjg8XRUmLraodehtVw0LYAWuRZP1bx0rkWA8QEE1G84t/ALkzIwlV+OHX+sn u4sg== X-Gm-Message-State: AA+aEWbLUh8h4VkJ5dE+C1kupNmcre9CiH0isLdh4jTUo2v4nO34SuJw xP55n3bAMfoSmY4A5ufJf96a6jHukEinxl237g== X-Received: by 2002:a17:906:2acf:: with SMTP id m15-v6mr14795041eje.180.1543907810709; Mon, 03 Dec 2018 23:16:50 -0800 (PST) MIME-Version: 1.0 References: <1543892757-4323-1-git-send-email-kernelfans@gmail.com> In-Reply-To: From: Pingfan Liu Date: Tue, 4 Dec 2018 15:16:39 +0800 Message-ID: Subject: Re: [PATCH] mm/alloc: fallback to first node if the wanted node offline To: David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Vlastimil Babka , Mike Rapoport , Bjorn Helgaas , Jonathan Cameron Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 4, 2018 at 11:53 AM David Rientjes wrote: > > On Tue, 4 Dec 2018, Pingfan Liu wrote: > > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > > index 76f8db0..8324953 100644 > > --- a/include/linux/gfp.h > > +++ b/include/linux/gfp.h > > @@ -453,6 +453,8 @@ static inline int gfp_zonelist(gfp_t flags) > > */ > > static inline struct zonelist *node_zonelist(int nid, gfp_t flags) > > { > > + if (unlikely(!node_online(nid))) > > + nid = first_online_node; > > return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags); > > } > > > > So we're passing the node id from dev_to_node() to kmalloc which > interprets that as the preferred node and then does node_zonelist() to > find the zonelist at allocation time. > > What happens if we fix this in alloc_dr()? Does anything else cause > problems? > I think it is better to fix it mm, since it can protect any new similar bug in future. While fixing in alloc_dr() just work at present > And rather than using first_online_node, would next_online_node() work? > What is the gain? Is it for memory pressure on node0? Thanks, Pingfan > I'm thinking about this: > > diff --git a/drivers/base/devres.c b/drivers/base/devres.c > --- a/drivers/base/devres.c > +++ b/drivers/base/devres.c > @@ -100,6 +100,8 @@ static __always_inline struct devres * alloc_dr(dr_release_t release, > &tot_size))) > return NULL; > > + if (unlikely(!node_online(nid))) > + nid = next_online_node(nid); > dr = kmalloc_node_track_caller(tot_size, gfp, nid); > if (unlikely(!dr)) > return NULL;