Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8014106imu; Tue, 4 Dec 2018 01:12:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/XAJ+TSIPd6obZj40TZvcYiI2KibD75M3RYTkyrHxqOi+WOwsEMx5SwTC+rx0XjNJl+lEOM X-Received: by 2002:a63:f615:: with SMTP id m21mr16561281pgh.428.1543914745514; Tue, 04 Dec 2018 01:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543914745; cv=none; d=google.com; s=arc-20160816; b=wAmSf3GCUj9dWq/fDHVRovoScKNLsMFf9Qf4vGbYHxb0uUEfMYWRm7OBTpShPtisOt PzxvX+2gd/ljj38n+FOxQJe2FEJevt+AVXsptGUGs9MD4hzlLmMJ20R4ZTG9DdOSL15b u5l2dne+IGRTCuVmdVky6RgTunHoEtULA0yZqDaPt1GQLBL6CEsFBNcOQnYYMMnXdVCD c07Zbgsh3bkNcv50rLULXeLK2rW+W83boB+Fea+uWcRq7SiiPUKCzEt5WfNP54ZduwMt 1XhUACMx98BZ2ypCjRBuEiPnW8bkMMN1FLBnFmQXlh9a9qedtUnBua4FgwTTsnFsY9AB g1Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=pW9RvKPkaSQKP8bBC1jyOkJZEOFUi7wqndA9TmJZYoU=; b=jd3qjyrR6zPLbkghSJAwQ6j5/sjCcL3+DIxRq06CP9zA/GwKJBsWURp+Y1p8enEiW/ zDSZkdya5CcmTVd3VeS9dRppnoblxGiR20R+o6ZaG+uV8/5pw5GwfrSzy6W9gj6iShBD sUXfHDrUcQVqfKhXvPVOTPnqwAWWiR8zefWUbvxYYouCPyFPve5HsQcHoxTf7eNzLhGP /S006R7sfv8HKQYMcC0JN6Fo1VDp/C0VxtuJjHerNv7HNnZ4KAikt98K5i0I2ZqEbmUO U76tmJKs/qJ+ErV6N/Pn9cG7m8DfNPiQp8n6fZzR7hMA65YlR0pwbZp+3CfEmzbySels x1Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CAoUxIVm; 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 x64si17105925pfx.87.2018.12.04.01.12.09; Tue, 04 Dec 2018 01:12:25 -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=CAoUxIVm; 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 S1725902AbeLDJJy (ORCPT + 99 others); Tue, 4 Dec 2018 04:09:54 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43731 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbeLDJJy (ORCPT ); Tue, 4 Dec 2018 04:09:54 -0500 Received: by mail-ed1-f68.google.com with SMTP id f9so6773806eds.10 for ; Tue, 04 Dec 2018 01:09:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pW9RvKPkaSQKP8bBC1jyOkJZEOFUi7wqndA9TmJZYoU=; b=CAoUxIVmNdR2sdarRHKTwk2FTPnjGoxyQPJzFW+4x5AJ/JJlk+RJiS5UI4fwsm2QBT ttqfce7yxm3x2FMtJs914/GgY9IqL9Jg8/TADK8hfY7Hv5e3gSrIeoFR7nHIo6TRtHKB Qqn5uyP189JYYH6edXySVbdswEolu9OKq+HxcBgkE/1W4thcowI++nMihyb1ThyfLR5G 8V8/tVDrCV47/MP30bzQDzbYIUKu10IMHEeb24MWTCb+3AE/o9Ydhq/Ishv+YviZjt4I NFFwnKY/c0VvwHsS1Zdw9chfg5QWIl6VnEGDJgRgiZXOOZl0gQry/uUp1g9t8oWfAsAP 5BwA== 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:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=pW9RvKPkaSQKP8bBC1jyOkJZEOFUi7wqndA9TmJZYoU=; b=aK5x3YjJCwBVdeoSMdy+XlmpuuRyWOgP11gOkTGA137HILsgm8vIr0B9HegJOAS2J8 twrkeBOYdbrVwwed86vHWDLo7m0gXXJ5wUuN+HMmB3Kq8xaJoFhhWWXfbh2pjRfbIVf4 OwGQLEt13mBskmcnxZSAMUs3b382pc7mkMfuyqXnmAulPuZfkGzdQAQ1POgq+ueouHRu BL2E2AxuMpp7+5moWkRENSFP13glQB4NmseNtltZIJLxhwa+a5EXtyhf9BamuqJTktmJ i78eGXZ4KmZGHcvOGxUu/5/7Dy2vRkeRpyxjGz+0QMibsiAzkaNH0c1AEfALZkRdQrRP xl3A== X-Gm-Message-State: AA+aEWYe4wJLGDS3agUtFTTZV6hj1qANiWEhL/QnlrIFvqYm09vV3DCH dUI1UewNBHcLlPp+yPih/3Q= X-Received: by 2002:a50:9106:: with SMTP id e6mr16421175eda.148.1543914592139; Tue, 04 Dec 2018 01:09:52 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id t9sm4477313edd.25.2018.12.04.01.09.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Dec 2018 01:09:51 -0800 (PST) Date: Tue, 4 Dec 2018 09:09:50 +0000 From: Wei Yang To: Pingfan Liu Cc: richard.weiyang@gmail.com, 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 Message-ID: <20181204090950.ql3zbnbjjbfnvhdg@master> Reply-To: Wei Yang References: <1543892757-4323-1-git-send-email-kernelfans@gmail.com> <20181204065453.4rsyhtsk2aej4vim@master> <20181204083428.emgcaomg6vulknaq@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 04, 2018 at 04:52:52PM +0800, Pingfan Liu wrote: >On Tue, Dec 4, 2018 at 4:34 PM Wei Yang wrote: >> >> On Tue, Dec 04, 2018 at 03:20:13PM +0800, Pingfan Liu wrote: >> >On Tue, Dec 4, 2018 at 2:54 PM Wei Yang wrote: >> >> >> >> On Tue, Dec 04, 2018 at 11:05:57AM +0800, Pingfan Liu wrote: >> >> >During my test on some AMD machine, with kexec -l nr_cpus=x option, the >> >> >kernel failed to bootup, because some node's data struct can not be allocated, >> >> >e.g, on x86, initialized by init_cpu_to_node()->init_memory_less_node(). But >> >> >device->numa_node info is used as preferred_nid param for >> >> >> >> could we fix the preferred_nid before passed to >> >> __alloc_pages_nodemask()? >> >> >> >Yes, we can doit too, but what is the gain? >> >> node_zonelist() is used some places. If we are sure where the problem >> is, it is not necessary to spread to other places. >> >> > >> >> BTW, I don't catch the function call flow to this point. Would you mind >> >> giving me some hint? >> >> >> >You can track the code along slab_alloc() ->...->__alloc_pages_nodemask() >> >> slab_alloc() pass NUMA_NO_NODE down, so I am lost in where the >> preferred_nid is assigned. >> >You can follow: >[ 5.773618] new_slab+0xa9/0x570 >[ 5.773618] ___slab_alloc+0x375/0x540 >[ 5.773618] ? pinctrl_bind_pins+0x2b/0x2a0 >where static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) > Well, thanks for your patience, but I still don't get it. new_slab(node) allocate_slab(node) alloc_slab_page(node) if (node == NUMA_NO_NODE) alloc_pages() eles __alloc_pages_node(node) As you mentioned, this starts from slab_alloc() which pass NUMA_NO_NODE. This means it goes to alloc_pages() and then alloc_pages_current() -> __alloc_pages_nodemask(). Here we use policy_node() to get the preferred_nid. I didn't catch the relathionship between policy_node() and device->numa_node. Maybe I got wrong in some place. Would you minding sharing more? >Thanks, >Pingfan -- Wei Yang Help you, Help me