From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F042B1F4295 for ; Tue, 7 Jan 2025 18:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736275187; cv=none; b=NbsIT7hO6t424PMDsi1h59rJ+wLVz1kpBkeaC3bnmmV8JzXdyNWFKGrj2nOzS28/QiJCIvhn9sjoRKKnudafUOpYfNaC0QLKOI4K43sMajE6nW917zCW9ah38DYE0XfzPRg2GIj0IltVW6b1mwCh1VEcT/s7DLxzep93x8fHl8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736275187; c=relaxed/simple; bh=ZE32P328TB2EI0G9HuPuNcmetZknmPglbvV9H1uUY5I=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=JErB2afJ93FUPX7QQDg7xLyD5RhN+ZUjPtDGO0GZyR3BmvTIMrtGR0Fkxh1xZ9DdqsbHZBZ2/40za3TepjjvPPPxRSveWbdAejzRU+QN5fx68NlLcBHhRn4qywYKFr89Mg50A9V49atDrOHqoD6dr70bRryRZv1zpPRAjZ2Xbak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=H92Zcsy9; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="H92Zcsy9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736275183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FsXFypI6YalpI5sYAe37inUBUMrzXs8VNJ8PByQyMIQ=; b=H92Zcsy93oDvCZ3UBKkbQzZ3/98869jJ3CJUHb+8FSJ0m/9lKAoBokN7u2CAkgxSkQktwE NJjVI0Aw6uBZMWK336FxB3R+zCNyq2xuwdJDOydckHh6myOmubHOfVRnqczUfg6qYUEUPM y5nBy3UH0Pb4a6qrpHHhBqQm66DsvvI= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-kZzHOFirO9KxJWmERqYSHA-1; Tue, 07 Jan 2025 13:39:39 -0500 X-MC-Unique: kZzHOFirO9KxJWmERqYSHA-1 X-Mimecast-MFC-AGG-ID: kZzHOFirO9KxJWmERqYSHA Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6dd43b16631so167990306d6.2 for ; Tue, 07 Jan 2025 10:39:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736275179; x=1736879979; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FsXFypI6YalpI5sYAe37inUBUMrzXs8VNJ8PByQyMIQ=; b=Xvnym+9FcbqTKpFHFic0Hd+l2UlVfWKRTpBX3lUAKU31HzCk2bOF2+o7Sc2OvUTL7r tgMRFw5iPcp6wA6fvk6x5+3ZEdylGtQoUhcGC2Vq6RwT4309cXAa6QTYNjdeiQN05DZe gqnHJHtgFk7W6FkoaAIaPCjcwN4maQVARQEJm3JCBLdZ5L5Gk1wP9zNGLoZaGZPacBNH 9T+z+7k0/eu2m7H5Wt/AVMWFbg7IQ00rlepW9EoMhN0xqkEoC11ZEUwviJhf2GEDsbXR OhT3b4w4gclXRkOgvGqiEtC3pzsoYUgAcj5t1Nb1qcUEDH7O3u93Ay0S8cINazhfySUu F8vA== X-Forwarded-Encrypted: i=1; AJvYcCV2x9X4UIgF1r+M7t8perE9kO6epg+CDsoLmMg+8iAZBY6gs94uisjgjvG4hKGG/aaVXlPh/gMisTtVve8=@vger.kernel.org X-Gm-Message-State: AOJu0YykFChp7OELhU00gDfpCUei1zk/M6t/NMHQ+jBlzWIqaUVOm670 ZLkkVwNkGFgGgbBAySRGvcSiHqeFaLbPhi/N9ednfOIWq7TlFgoHhm+AQ4SWVKk6mEmCWlDU8eO L8DnW24T5IMzKMs0Vq1Vfkk7oKK8mUxVB6hajY8u0TVAuwmCe2vybPVHedE08OQ== X-Gm-Gg: ASbGncsmk1dxibF573LTsrMESR14TApG+KF5XUlOz/MI3YSmFxGAhWn/wrcBzSz8qL5 tmdYCsY6meTz+LNTe8gxJorcEDstR0NWKYrYVmF7pM/YK56Uu9fdnWGU5Y+9rHHbdGH5nelMW9S eRWD8z4ttIVT3duLN1yH7rBlPy287mOG09/dzHuuL1Ox9PlUOI/681yIWmiMk+ehTjWV1C2vjmg 8UzR3FplcfLNxzYuStImTsI1FLlF8J9NB72w8+cQDnq128zrFDQBsb3dgMUqZ5PkIr53rxxgN73 tLNqNdizZBYEZMRPXYZO1Yp5 X-Received: by 2002:a05:6214:5a08:b0:6d8:b594:c590 with SMTP id 6a1803df08f44-6df9b1d2277mr2504406d6.6.1736275179352; Tue, 07 Jan 2025 10:39:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvAmKYvFCQe7RrfAirYBjl3dxbzIxEINJaR0Uh7v+JoUme03c5Avp3BJE0UmbXu6TjJRpL7w== X-Received: by 2002:a05:6214:5a08:b0:6d8:b594:c590 with SMTP id 6a1803df08f44-6df9b1d2277mr2504196d6.6.1736275179108; Tue, 07 Jan 2025 10:39:39 -0800 (PST) Received: from ?IPV6:2601:188:ca00:a00:f844:fad5:7984:7bd7? ([2601:188:ca00:a00:f844:fad5:7984:7bd7]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd180ea715sm183440026d6.11.2025.01.07.10.39.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jan 2025 10:39:38 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Tue, 7 Jan 2025 13:39:36 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] sched/fair: Ignore isolated cpus in update_numa_stat To: Chuyi Zhou , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, riel@surriel.com Cc: chengming.zhou@linux.dev, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org References: <20250103065930.413464-1-zhouchuyi@bytedance.com> <20250103065930.413464-3-zhouchuyi@bytedance.com> Content-Language: en-US In-Reply-To: <20250103065930.413464-3-zhouchuyi@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/3/25 1:59 AM, Chuyi Zhou wrote: > Now update_numa_stats() iterates each cpu in a node to gather load > information for the node and attempts to find the idle cpu as a candidate > best_cpu within the node. > > In update_numa_stats() we should take into account the scheduling domain. > This is because the "isolcpus" kernel command line option and cpuset iso- > late partitions can remove CPUs from load balance. Similar to task wakeup > and periodic load balancing, we should not involve isolated CPUs in NUMA > balancing. When gathering load information for nodes, we need to ignore the > load of isolated CPUs. This change also avoids selecting an isolated CPU > as the idle_cpu. > > Signed-off-by: Chuyi Zhou > --- > kernel/sched/fair.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index f544012b9320..a0139659fe7a 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -2125,6 +2125,11 @@ static void update_numa_stats(struct task_numa_env *env, > for_each_cpu(cpu, cpumask_of_node(nid)) { > struct rq *rq = cpu_rq(cpu); > > + /* skip isolated cpus' load */ > + if (!rcu_dereference(rq->sd)) > + continue; > + > + ns->weight++; > ns->load += cpu_load(rq); > ns->runnable += cpu_runnable(rq); > ns->util += cpu_util_cfs(cpu); > @@ -2144,8 +2149,6 @@ static void update_numa_stats(struct task_numa_env *env, > } > rcu_read_unlock(); > > - ns->weight = cpumask_weight(cpumask_of_node(nid)); > - > ns->node_type = numa_classify(env->imbalance_pct, ns); > > if (idle_core >= 0) You should initalize ns->weight to 0 first before iteration to prevent pre-existing ns->weight value from corrupting the result. Cheers, Longman