Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1476283pxp; Thu, 10 Mar 2022 06:15:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgDo0CUaOdWsx2cr/g2wCEZliuBHoZgcpuuI+zTZfY1Szsijz3MfCjyk5v3WDyTIgUbsYl X-Received: by 2002:a50:9fe1:0:b0:416:a97:e962 with SMTP id c88-20020a509fe1000000b004160a97e962mr4621070edf.315.1646921722683; Thu, 10 Mar 2022 06:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646921722; cv=none; d=google.com; s=arc-20160816; b=blYb6gsDVWWqX19+WisA6VmZCGO+8Fp1hRUwdrJ7+k1Y2ti8McU8KRGzGTLqlnqBeT 18ueDdombLbvGUlDdVoqRbWrKqyE+mB0FkWjdMOFX1qVpSgcqySDfEthBLjrVgvlDRXX Vihug9+jkttD2ps2Cf8hVgzK2eK6EdkpFXL+U3lcHG6j0cKM1SGsPnM4T6eeRSyFfHld 3pgvn2LI+9lQXlef8SEF93Vc0+qUfMxlX5FPxkMye1wCDeF06hVCOjW0y7K3aCjZEA9t IQX2UsgtfsGwRqtXwiknlERL6/aL5yThpJwxyZR+4qDqrEM1iSAH8zM8fOfIhkTJAC4D Qa9w== 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:subject:user-agent:mime-version:date:message-id; bh=X8EEGUNDCeJtpZaOsV8fEyQAffX7Jsgb3dYzfaRT0ls=; b=u+Joooj3t5y/5S3alopXID97I4fyfRh0szx1H5treO86R/5xREQ9sC7qWB5js02a6b lTxvQCrbV5G3xQI6qjUB1EXg7aa6bXJORRP5PdivNVHIM3JKli885C9/p18n0rPUt4LM YZzZ3hu9Os9FxvhRI4qOjlOthcknq9w7rFvjNIw9o9nfjV/rmbqoKVCdu79hlFd48sAJ 0RwlBhJ9pWA2fdw3WOdA+v44aocnI+Get3p9deBzpVMnBj0Wds6D6sttW8hOz5Je8SRF 5i1He0e5E5mjD9Ojx4ckAOXSnK+UY4ymgGZlgho8pS7oMt2B0ir0odbZ/uBKFdwfR+cn 2DCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a509308000000b00416a713f4c5si1901884eda.376.2022.03.10.06.14.58; Thu, 10 Mar 2022 06:15:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239756AbiCJGYl (ORCPT + 99 others); Thu, 10 Mar 2022 01:24:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbiCJGYj (ORCPT ); Thu, 10 Mar 2022 01:24:39 -0500 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D587A3F8B4 for ; Wed, 9 Mar 2022 22:23:38 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0V6nNtMc_1646893414; Received: from 30.97.48.73(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0V6nNtMc_1646893414) by smtp.aliyun-inc.com(127.0.0.1); Thu, 10 Mar 2022 14:23:35 +0800 Message-ID: Date: Thu, 10 Mar 2022 14:24:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] mm: Only re-generate demotion targets when a numa node changes its N_CPU state To: Oscar Salvador , "Huang, Ying" Cc: Andrew Morton , Dave Hansen , Abhishek Goel , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220309144644.4278-1-osalvador@suse.de> <87bkyefxnq.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oscar, On 3/10/2022 1:48 PM, Oscar Salvador wrote: > On Thu, Mar 10, 2022 at 08:39:53AM +0800, Huang, Ying wrote: >> We need to call set_migration_target_nodes() during system boot >> somewhere, either here or in init_mm_internals(). > > Hi Huang Ying, > > vmstat_cpu_online() already gets called during boot: > > static struct cpuhp_step cpuhp_hp_states[] = { > ... > #ifdef CONFIG_SMP > [CPUHP_CREATE_THREADS]= { > .name = "threads:prepare", > .startup.single = smpboot_create_threads, > .teardown.single = NULL, > .cant_stop = true, > }, > ... > > smpboot_create_threads > __smpboot_create_thread > smpboot_thread_fn > ht->thread_fn() > cpuhp_thread_fun > cpuhp_invoke_callback > vmstat_cpu_online > > That for every CPU that is brought up during boot. > > So unless I am missing something, I would say we are already covered > there, right? I've tested your patch, unfortunately it can not work. It already set the node with N_CPU state in init_cpu_node_state() earlier, so in vmstat_cpu_online() ,the sentence 'if(!node_state(cpu_to_node(cpu), N_CPU))' is always false, which means it will not call set_migration_target_nodes(). Like Huang Ying said, we should call set_migration_target_nodes() in migrate_on_reclaim_init() or init_mm_internals().