Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp980848rda; Sun, 22 Oct 2023 20:17:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOw7y6nGDvMwfIgjU6i83GxQubF5GESOvtT0h/VmT+8Y50k8iccfuzu3t/Su06SgT5f1k6 X-Received: by 2002:aa7:9e09:0:b0:6b2:6835:2a7f with SMTP id y9-20020aa79e09000000b006b268352a7fmr8329846pfq.22.1698031066014; Sun, 22 Oct 2023 20:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698031065; cv=none; d=google.com; s=arc-20160816; b=lQy5+PMhR1N0hOPzMjdTM8NoSKDGmdlXsrMGqWoWreNzmGHZh/Hp8Y+SPS5FF0hrj/ FAuRxGqNNZP2+p8u3Vzhn6mxz8rpBb2d38ekiMsyk7iBjpnAhQIXrZxHQ067lyxvHIto 1zOw2c6HTcxVoSlA78eB7lrUxRHGa0b5DzvjHAULXpRaE4s3mFzt+fy/AoaLFDQuV4a1 aTagNw6RgrpTCGAONMlbJvvub9zfZopZck1s/31mrH/QjPGorIhK9QG5aEwxltL4RNAu 2JnQ9UF4sR8yrLF+Pvps0PwKBYvtyOl66ig91+gL5i7tTLy62SEJOr/9ESJjnNnYBlDT ov6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6jfYZQdraBUPgyo62HJV8eAR1Elgs5AqdiMTxOIu60E=; fh=2L/hDiu7J6Y6rbKURIS3dtajIeFK97FUzqUcRqhpQok=; b=JmxkMKVpOL4zdCZFNir4mHAiufGzK+ows0th+mudgbNAquQmunnXI0AXDqZ/T8UoQp JJkCrXpnoDvu4OIm3UplFPn3R9samMNbgLWHjwBmGXZ1g9GyPDRi3wujJSUDoOE0B3vO UHYee2MzOrMmCpeNhjZz8E8MU82MKXYlc8742X+TDZZJG0NWHQCpmOBt3eHL9ODn4L9N YiMX3vQn4lK+7zCESXGl7SK8ax80Ii8NYkRWG7oBElZHcn3z3pGctr/ygui8F+0Xn2wV NBFw0ZRO2oElblKPG2Qy9iuMfUdCcm+Ox0ka3yarXgY86r9hTS2Hk1vgj6J4v5+g8E5P eCzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=g5z3g9um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q18-20020aa79612000000b006b1fec25a82si5558448pfg.403.2023.10.22.20.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 20:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=g5z3g9um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id F34108080EEC; Sun, 22 Oct 2023 20:17:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbjJWDRd (ORCPT + 99 others); Sun, 22 Oct 2023 23:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjJWDRc (ORCPT ); Sun, 22 Oct 2023 23:17:32 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B175188 for ; Sun, 22 Oct 2023 20:17:12 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1ca85ff26afso4889765ad.1 for ; Sun, 22 Oct 2023 20:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698031031; x=1698635831; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6jfYZQdraBUPgyo62HJV8eAR1Elgs5AqdiMTxOIu60E=; b=g5z3g9umsc1oQq3dxhbUp7aNgpZghghCmsNx4fb9T4gIDPpwEpYsP5wGgFfR1oUfry YmSp5pM4hp8O0816CG/AgfEzTfwo1BU58aqdnyWYUNQA3acwC787UZH/gVilmZU9M5R8 QW5bDjmllllPzOvq4fH1WAluCBu2yV/Y2KhmtAceHgx/CnCEJLhzyC6MoAGGE2LVw3gh M21xrdE37noBQh/yqDvGtu1s1g7TYzMmMgzQQpk50kGDKMzUtnlJyX395TB1LgaUAdn7 1/w8Amsw985x7XXu5d80aVFqTAUb2aBWgpdfHCL0kGsm48WrdT5gksyrNoimubXvwI3m uxTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698031031; x=1698635831; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6jfYZQdraBUPgyo62HJV8eAR1Elgs5AqdiMTxOIu60E=; b=RwZX2X5VvZRTjg+GbSGJXRbDxWi0Zx4ucUnA46pHWDmOIFxCOzi7PPmDHla9S3WQS+ gv0xGQDzwgg5Qysi8I31dZhmtAV0sZPqLyKHvzY/OA4wd6vmdcmY66yAA23rl1RoZw2q gvZutgaaqoL/fVph/rPlnLk74ixrOJZgTWaCXVV+TiQjuW6L6AmN/SObzC9iepsw41lo f1D7VZLh2EKEKiY3ebfR0/7sVXTY301OBiZ8Py9tRfmZ//tjP2FITkeF40H7DeePv5aj cfTotqQj6zUZNr8T8XMB769hyVpiwUb/+LH0z6h3EklCcG7yFLMjXvrN9XZ7iBVzdSib A4RA== X-Gm-Message-State: AOJu0YzAhfya9jFdjiq0VJKAm+D3LDy+ThqgKySUJQrSFRVZDf893X+Z GRhbQRnwoQiancRR03zFvk+k0g== X-Received: by 2002:a17:903:6c7:b0:1ca:85b4:b962 with SMTP id kj7-20020a17090306c700b001ca85b4b962mr7831135plb.4.1698031031255; Sun, 22 Oct 2023 20:17:11 -0700 (PDT) Received: from [10.4.238.83] ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id s17-20020a170902989100b001b8a00d4f7asm5013778plp.9.2023.10.22.20.17.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 22 Oct 2023 20:17:10 -0700 (PDT) Message-ID: Date: Mon, 23 Oct 2023 11:17:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] mm: memory_hotplug: drop memoryless node from fallback lists Content-Language: en-US To: akpm@linux-foundation.org, "Huang, Ying" Cc: rppt@kernel.org, david@redhat.com, vbabka@suse.cz, mhocko@suse.com, willy@infradead.org, mgorman@techsingularity.net, mingo@kernel.org, aneesh.kumar@linux.ibm.com, hannes@cmpxchg.org, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <9f1dbe7ee1301c7163b2770e32954ff5e3ecf2c4.1697711415.git.zhengqi.arch@bytedance.com> <87bkctg4f4.fsf@yhuang6-desk2.ccr.corp.intel.com> <4bfa007c-a20f-9e68-4a9f-935dacf43222@bytedance.com> <8734y2f868.fsf@yhuang6-desk2.ccr.corp.intel.com> <87pm16doe5.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Qi Zheng In-Reply-To: <87pm16doe5.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 22 Oct 2023 20:17:43 -0700 (PDT) On 2023/10/23 11:10, Huang, Ying wrote: > Qi Zheng writes: > >> Hi Ying, >> >> On 2023/10/23 09:18, Huang, Ying wrote: >>> Qi Zheng writes: >>> >>>> Hi Ying, >>>> >>>> On 2023/10/20 15:05, Huang, Ying wrote: >>>>> Qi Zheng writes: >>>>> >>>>>> In offline_pages(), if a node becomes memoryless, we >>>>>> will clear its N_MEMORY state by calling node_states_clear_node(). >>>>>> But we do this after rebuilding the zonelists by calling >>>>>> build_all_zonelists(), which will cause this memoryless node to >>>>>> still be in the fallback list of other nodes. >>>>> For fallback list, do you mean pgdat->node_zonelists[]? If so, in >>>>> build_all_zonelists >>>>> __build_all_zonelists >>>>> build_zonelists >>>>> build_zonelists_in_node_order >>>>> build_zonerefs_node >>>>> populated_zone() will be checked before adding zone into zonelist. >>>>> So, IIUC, we will not try to allocate from the memory less node. >>>> >>>> Normally yes, but if it is the weird topology mentioned in [1], it's >>>> possible to allocate memory from it, it is a memoryless node, but it >>>> also has memory. >>>> >>>> In addition to the above case, I think it's reasonable to remove >>>> memory less node from node_order[] in advance. In this way it will >>>> not to be traversed in build_zonelists_in_node_order(). >>>> >>>> [1]. https://lore.kernel.org/all/20230212110305.93670-1-zhengqi.arch@bytedance.com/ >>> Got it! Thank you for information. I think that it may be good to >>> include this in the patch description to avoid potential confusing in >>> the future. >> >> OK, maybe the commit message can be changed to the following: >> >> ``` >> In offline_pages(), if a node becomes memoryless, we >> will clear its N_MEMORY state by calling node_states_clear_node(). >> But we do this after rebuilding the zonelists by calling >> build_all_zonelists(), which will cause this memoryless node to >> still be in the fallback nodes (node_order[]) of other nodes. >> >> To drop memoryless nodes from fallback nodes in this case, just >> call node_states_clear_node() before calling build_all_zonelists(). >> >> In this way, we will not try to allocate pages from memoryless >> node0, then the panic mentioned in [1] will also be fixed. Even though >> this problem has been solved by dropping the NODE_MIN_SIZE constrain >> in x86 [2], it would be better to fix it in the core MM as well. >> >> [1]. https://lore.kernel.org/all/20230212110305.93670-1-zhengqi.arch@bytedance.com/ >> [2]. https://lore.kernel.org/all/20231017062215.171670-1-rppt@kernel.org/ >> >> ``` Hi Andrew, can you help modify the commit message to this? :) Thanks, Qi > > This is helpful. Thanks! > > -- > Best Regards, > Huang, Ying > >> Thanks, >> Qi >> >>> -- >>> Best Regards, >>> Huang, Ying >>> >>>> Thanks, >>>> Qi >>>> >>>> >>>>> -- >>>>> Best Regards, >>>>> Huang, Ying >>>>> >>>>>> This will incur >>>>>> some runtime overhead. >>>>>> >>>>>> To drop memoryless node from fallback lists in this case, just >>>>>> call node_states_clear_node() before calling build_all_zonelists(). >>>>>> >>>>>> Signed-off-by: Qi Zheng >>>>>> Acked-by: David Hildenbrand >>>>> [snip] >>>>> -- >>>>> Best Regards, >>>>> Huang, Ying