Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10531719imu; Thu, 6 Dec 2018 02:45:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/WrLwBs5n48P86Nhb+gPYLqhkKf3w1IIGspOr1yAC2xjzD3e6hcnDnWj5jmJGM+FcoSOhP0 X-Received: by 2002:a63:9845:: with SMTP id l5mr23618418pgo.142.1544093110251; Thu, 06 Dec 2018 02:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544093110; cv=none; d=google.com; s=arc-20160816; b=02LtLOD43NR+VD3N1WIJEc1rvAEWin5V8KQDwifE/KRC30edkC15kldORzovHUMOZY kYFYaisk6AaWxyaThQEfyMOcTI5J6lrAXYUvYrNc6lFae1NIEuiSonVKWu6Aroc7OqjP lyGu/eYhmAD33w7FOiOZM9IWgwIQTkOuGd61P85zForNTqwIOWSAagmcsgr+kwFwj+Wc xEo6zeuDDp8Ap+nnLc4T40i9COAccGHL8IIdga9zwEMJgiROraLpZ2CqXWVa1JO4Ak3q cqJL4abGIMP3buJGlKYw9Lcij7D131achO9k854s/plFGJjIijRgFIocfJDN1U8ZzNGo 0GKQ== 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=zbBGDc/bjaMxusFr5D0Ux7T0depHkjTCJV3JvAD04Ss=; b=BrJX9flcnWUV+OIO7X5d/JWrpRLSzIE+X9uReNT/8cJa8cZ8zbRorWfiDlj6yWac4i m319WJS33impyF4rJPkCVb6yFtrm8kui0BEuYzwghwNhr9+SAj/gS/ZRTHghtOuKaRHY imgG/sn8ZZLHLHoOTTNB9kBoatw2Gcn52qoeVVSCrH6iOcFeTLlyFlmrzwCZskIgshN2 gFOU7439zBDX4Ryh+JzPgB9alsyGQXkgsaDd33NKm5gBP4K5j28e5N9H9O3UZ30hrXR3 BbNS7mtB0pQphux7QOZHBZI/SI4odLTgkDbiHBtSt3yYXbIOT9fKMDIJ7zidSZIyZLUT RB6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QjAjMDTi; 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 b128si22713535pfa.283.2018.12.06.02.44.53; Thu, 06 Dec 2018 02:45:10 -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=QjAjMDTi; 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 S1729265AbeLFKoR (ORCPT + 99 others); Thu, 6 Dec 2018 05:44:17 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37794 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727575AbeLFKoQ (ORCPT ); Thu, 6 Dec 2018 05:44:16 -0500 Received: by mail-ed1-f66.google.com with SMTP id h15so361010edb.4 for ; Thu, 06 Dec 2018 02:44:15 -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=zbBGDc/bjaMxusFr5D0Ux7T0depHkjTCJV3JvAD04Ss=; b=QjAjMDTiIYBhrASPkjzies6VE1avYYTH0v7g8apbmte1AM5JzVa4l9eboHswlmtPe4 OEqlTXmtJ8X+dku5ecIoFWiIA56/BM/r30+/8/2hEnZCDOA30nPWH8u40DaDNY8y6R/M nyJS4GodOBf0Q/gzBqrsIK7FRbmiraw/GrnrhOKpFs/+rNgJCVMCIZ5Lp6zdv43Jqwf6 Kuohl+JQYaJIPl4EYhgLv8YkCXklde/3Vxc42zePIX3A6hjDgydJd8cFjws08vr68u9C DTsNai762ciSvCcSgmobz0fj34eGLA148mzXphBs3pLQd9gbL730ee4WKZcyFLVXN63m e1Nw== 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=zbBGDc/bjaMxusFr5D0Ux7T0depHkjTCJV3JvAD04Ss=; b=ofeA1pYCl62vtv5iuXSItO5Zy7ABxbrfL55WOuJCe2Xa3ofVFkSFiCc0XHgJfutSul zB0uCARTmuoUTIiib26AU9VOyjOmJNBGeVj1ko870gHlaMLJN/HNxogQv1K4B4wgmhMm xmBUOejRhY3hNxRTk8wnV48C1ZsimLbcCR91d2zMtApiOtveEuIbZdicUtrLeBmf9J2X Ti51qAL5GydqEyTttYz+74jIsRdHJDHpt8rlSMI+BdZbbSRDv9gbWfdWaedVo4FHcIQN LNB8TLyZbANP4DH+qOaeWQHG2hEleDRLAUW9dyZvqb4/D77EGIK6fRaADIWLQ3MKZwpr FD+w== X-Gm-Message-State: AA+aEWahBNQT311YGvUFfbFKltha5WWNiBzCZt32yxUh5ruxu0zJxZxm X6DrfM+a95TU3L4hExjdA4twXOFzmjtE9w+kTNKf4S8= X-Received: by 2002:a17:906:a281:: with SMTP id i1-v6mr21253730ejz.86.1544093054778; Thu, 06 Dec 2018 02:44:14 -0800 (PST) MIME-Version: 1.0 References: <1543892757-4323-1-git-send-email-kernelfans@gmail.com> <20181204072251.GT31738@dhcp22.suse.cz> <20181204085601.GC1286@dhcp22.suse.cz> <20181205092148.GA1286@dhcp22.suse.cz> <186b1804-3b1e-340e-f73b-f3c7e69649f5@suse.cz> <20181206082806.GB1286@dhcp22.suse.cz> In-Reply-To: From: Pingfan Liu Date: Thu, 6 Dec 2018 18:44:03 +0800 Message-ID: Subject: Re: [PATCH] mm/alloc: fallback to first node if the wanted node offline To: mhocko@kernel.org Cc: Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , 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 Thu, Dec 6, 2018 at 6:03 PM Pingfan Liu wrote: > > [...] > > THanks for pointing this out. It made my life easier. So It think the > > bug is that we call init_memory_less_node from this path. I suspect > > numa_register_memblks is the right place to do this. So I admit I > > am not 100% sure but could you give this a try please? > > > Sure. > > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > > index 1308f5408bf7..4575ae4d5449 100644 > > --- a/arch/x86/mm/numa.c > > +++ b/arch/x86/mm/numa.c > > @@ -527,6 +527,19 @@ static void __init numa_clear_kernel_node_hotplug(void) > > } > > } > > > > +static void __init init_memory_less_node(int nid) > > +{ > > + unsigned long zones_size[MAX_NR_ZONES] = {0}; > > + unsigned long zholes_size[MAX_NR_ZONES] = {0}; > > + > > + free_area_init_node(nid, zones_size, 0, zholes_size); > > + > > + /* > > + * All zonelists will be built later in start_kernel() after per cpu > > + * areas are initialized. > > + */ > > +} > > + > > static int __init numa_register_memblks(struct numa_meminfo *mi) > > { > > unsigned long uninitialized_var(pfn_align); > > @@ -592,6 +605,8 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) > > continue; > > > > alloc_node_data(nid); > > + if (!end) > > + init_memory_less_node(nid); > > } > > > > /* Dump memblock with node info and return. */ > > @@ -721,21 +736,6 @@ void __init x86_numa_init(void) > > numa_init(dummy_numa_init); > > } > > > > -static void __init init_memory_less_node(int nid) > > -{ > > - unsigned long zones_size[MAX_NR_ZONES] = {0}; > > - unsigned long zholes_size[MAX_NR_ZONES] = {0}; > > - > > - /* Allocate and initialize node data. Memory-less node is now online.*/ > > - alloc_node_data(nid); > > - free_area_init_node(nid, zones_size, 0, zholes_size); > > - > > - /* > > - * All zonelists will be built later in start_kernel() after per cpu > > - * areas are initialized. > > - */ > > -} > > - > > /* > > * Setup early cpu_to_node. > > * > > @@ -763,9 +763,6 @@ void __init init_cpu_to_node(void) > > if (node == NUMA_NO_NODE) > > continue; > > > > - if (!node_online(node)) > > - init_memory_less_node(node); > > - > > numa_set_node(cpu, node); > > } > > } > > -- > Which commit is this patch applied on? I can not apply it on latest linux tree. > I applied it by manual, will see the test result. I think it should work since you instance all the node. But there are two things worth to consider: -1st. why x86 do not bring up all nodes by default, apparently it will be more simple by that way -2nd. there are other archs, do they obey the rules? Thanks, Pingfan