Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7787004imu; Mon, 3 Dec 2018 19:54:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHl+WJdRrQI7+QaqqfbzLN+0zyPDvQAKIrNO1mY+OalSFdi2Cz2c8tjSv/Qqopy1ujkCdY X-Received: by 2002:a17:902:a50a:: with SMTP id s10mr17700123plq.278.1543895686992; Mon, 03 Dec 2018 19:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543895686; cv=none; d=google.com; s=arc-20160816; b=sIvaN8DUyq6+caKAlHwW56eciJbljC7JxIGKQQZfKgsLY4YAY3iEihlIcgYfKzDyLR 9GBWJlNIbsCbNGhqxUA4DQGX+kj1UJkB3wzYDPB69VqcTw3z1X316t+sdGIU0CtPvZtM XNHmneXYr3PfqgGye18QkHBm74Lr2sLhsiiAOS3PWNKZOLsfr/lzrf36EYdDUcQYzAKZ rxfMcL0OgtUWEzcquty8AcVaYafyUFc/pUccNLSOwjTabz6cpq/ufbTzvBqDlKE5qtWh gwwueppSBxw45E1phFtOdkPOCgYeQFzNON+cqHC3u+rDz19XKNEyOy+73onQ7reIrzrY 2wpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=vTyC0Iyetumvi87Gb6Zwj3AYUL4Tsn5doEXtnMc5zs8=; b=qIwdHyD+iIQO3bdP8YP4SnTlmYW8l5GnQTJQNF+G+wnzVzPcSulyCWEjKFrLLt3VJM 9oJrgDQyJNgDJblXasAHlR4q37RsQoZYE7SGIFU6UmE6C+3IIWtDhaCzhj4o/ma6SWM/ gibfFhBiLrh1MT0MlK7KDFhaSqzBmOmcvmadpmvDuOrIVdOF9tcNobrnIGLP5Z6hTIxq 2bIp6ARpLwzBWC8lyVhXcK6+B0eXjl3dzlHQQ7ABUih0TZOlqutvjmdfs+APNtB4utMD hcPhZlZhS+UWbxu92RTEvdVjJ0qGvpMZsGEYK/rwNn8BtNNILAMY0yNkTzYYOqWCElx0 v4ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b5PCq6XG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10si15781168plt.295.2018.12.03.19.54.31; Mon, 03 Dec 2018 19:54:46 -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=@google.com header.s=20161025 header.b=b5PCq6XG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726001AbeLDDx4 (ORCPT + 99 others); Mon, 3 Dec 2018 22:53:56 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43558 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbeLDDx4 (ORCPT ); Mon, 3 Dec 2018 22:53:56 -0500 Received: by mail-pg1-f196.google.com with SMTP id v28so6719752pgk.10 for ; Mon, 03 Dec 2018 19:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=vTyC0Iyetumvi87Gb6Zwj3AYUL4Tsn5doEXtnMc5zs8=; b=b5PCq6XGU0JP9pYfMYj0OgBcIY4IGSzZdnUJ2LIG2VVsKb8CA+zmBTQOOYb/COzmrj gPK5aO+7/c23P/CQQwYXinpDUy4y6pW6UfrGYnlYTp1CDbC7uT+vM+35v0u7Owu1LgYs DrZCK5owszOy0i/KbQIgnZ8snAdOD1IhcbaDABEdQ0vvhetz5Q3gkgX6Exb1XwG/rkFh Agm8lp85N+sddX9Qtlhyswso9Lq2Bpf0qneVpxexOUI1uPb6io+npQ4RXQKG9E5dGrVZ Tk0xZc07hixAYB+UZI+Z1V09mFZjs7rDyyJQGNJVCFZFWBdKaNSmJGRuuHb8MldYcbQu mhXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=vTyC0Iyetumvi87Gb6Zwj3AYUL4Tsn5doEXtnMc5zs8=; b=Nrd2atXlABUBUQQyPiETyr+vhVt7KJcuTbo3ZqCyFl4mChZ4YKU7iqqiBPplu2Ssc1 1+6mKvgs8XpnmNA6HEeGjQ3591dzkefSPNBiFt/EqqGdFWj5kTEDm6I0BDW/5CxaUWv5 fqW6yxESu30J9irMtd5ZEqDNi1fDhCRxv28IE4xOFV8ZeuJWFnmrHuXmBtxyk0DGBKpB VepXMGA+4JmrLl3m4nVXNumHeKwxydy5n+yziS0m/C5q+mWDm5MzhndXKPc2WL+dAm28 U/Wrio1O2gS2VLXIPoOI2kH3JJCiDjWFpXEG/kLXVh3sIKd+ddY1ZzE063Keryn9BEQX FwaQ== X-Gm-Message-State: AA+aEWbz4b/bWY61bEVi0Pbe8bUapL497QG4zB3JkgpVZtdZQy3/ZZTc N5pt0CTUxDj6Afo97qcCIWsZz5gGZMo= X-Received: by 2002:a63:c447:: with SMTP id m7mr15442288pgg.27.1543895634197; Mon, 03 Dec 2018 19:53:54 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id x3sm23675360pgk.18.2018.12.03.19.53.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Dec 2018 19:53:53 -0800 (PST) Date: Mon, 3 Dec 2018 19:53:52 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Pingfan Liu cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Vlastimil Babka , Mike Rapoport , Bjorn Helgaas , Jonathan Cameron Subject: Re: [PATCH] mm/alloc: fallback to first node if the wanted node offline In-Reply-To: <1543892757-4323-1-git-send-email-kernelfans@gmail.com> Message-ID: References: <1543892757-4323-1-git-send-email-kernelfans@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? And rather than using first_online_node, would next_online_node() work? 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;