Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3176284ybt; Mon, 29 Jun 2020 17:49:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycp78V1FojcK8CPVke2RBIr7fDrjtU8L1K/w8JKMxhTKRaaTe5qOE5HUynYRFfnmqUNbCa X-Received: by 2002:aa7:d7d0:: with SMTP id e16mr20157825eds.10.1593478194291; Mon, 29 Jun 2020 17:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593478194; cv=none; d=google.com; s=arc-20160816; b=HARm6Fu1i3vWUbLCFG4KKy/IkOBpL8NsiSZoYcBevrSxhF6L6sUI7t2tIUu7rT5YMy yjQoAZkHp4dPenoICQMO709Fm3bs83Epfz5Ze/SenDvxyxVt+01ReEvgAal8YO9KckOp KMpO5o3S4PQY6+Y3XcXY87ur0t4b8bo/XjxKh1qMRT0zx2XnvmzZLFSQMR6qceSjpeaG wp9JSYze46N4gwqhVmAyBRVOrvMgO+oE0ayl8gVWWHtEQXdVL3FPooK46dR7Bjv9+ylb RdFSU+owG23C9GYNyMDkPw3boNetpM8gZLSDXJAjxLBKR3jQ8CZGla4DdN0LS/Z37+YF 6kMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=PfO3JjrvFkg+AkJadEhmJUHS1g0hiTOXMPY9sxV849A=; b=0/X0cm9Nw5fgRwpln15274fXl3fy/OjoVPyrf53yG0cD920hHw7jO3GdF2xlcHKycI NH+rLqD6TXgg7MaO7vafDRkv6gD42l9KGz/bSUiZocvlbF03Kb2yu2krVX+0m3zbB8r5 A8ZSv+TQ+FLmyIx/Jtb2x9DE7SIj17DPPBKLp9XBabgHhgSHyimrn6m8n5gaBo1Dsltw b3mTn5np4M0tRpPwW2aiUGONQGxk4WOChJHhGtMYK5NnarWWvOsAEzi+7YEgw+QEVYYz taV9xYVrRAmLkh/m12RU55CVEnR+GGRnhyUw86WDjs0K6FamJoK8b7Q386cSjbGZUUIr wPOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx2si762273ejb.706.2020.06.29.17.49.30; Mon, 29 Jun 2020 17:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbgF3Asz (ORCPT + 99 others); Mon, 29 Jun 2020 20:48:55 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6880 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726056AbgF3Asz (ORCPT ); Mon, 29 Jun 2020 20:48:55 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 53CFF9DD4C284405C498; Mon, 29 Jun 2020 17:01:50 +0800 (CST) Received: from [127.0.0.1] (10.67.76.251) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Mon, 29 Jun 2020 17:01:41 +0800 Subject: Re: [Patch v3 1/3] lib: Restrict cpumask_local_spread to houskeeping CPUs To: Andrew Morton , Nitesh Narayan Lal CC: , , , , , , , , , , , , , , , , yuqi jin References: <20200623192331.215557-1-nitesh@redhat.com> <20200623192331.215557-2-nitesh@redhat.com> <20200624122647.766bec7760d9197ba71a58c4@linux-foundation.org> From: Shaokun Zhang Message-ID: Date: Mon, 29 Jun 2020 17:01:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200624122647.766bec7760d9197ba71a58c4@linux-foundation.org> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.76.251] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, ?? 2020/6/25 3:26, Andrew Morton ะด??: > On Tue, 23 Jun 2020 15:23:29 -0400 Nitesh Narayan Lal wrote: > >> From: Alex Belits >> >> The current implementation of cpumask_local_spread() does not respect the >> isolated CPUs, i.e., even if a CPU has been isolated for Real-Time task, >> it will return it to the caller for pinning of its IRQ threads. Having >> these unwanted IRQ threads on an isolated CPU adds up to a latency >> overhead. >> >> Restrict the CPUs that are returned for spreading IRQs only to the >> available housekeeping CPUs. >> >> ... >> >> --- a/lib/cpumask.c >> +++ b/lib/cpumask.c >> @@ -6,6 +6,7 @@ >> #include >> #include >> #include >> +#include >> >> /** >> * cpumask_next - get the next cpu in a cpumask >> @@ -205,22 +206,27 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask) >> */ >> unsigned int cpumask_local_spread(unsigned int i, int node) >> { >> - int cpu; >> + int cpu, hk_flags; >> + const struct cpumask *mask; >> >> + hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; >> + mask = housekeeping_cpumask(hk_flags); >> /* Wrap: we always want a cpu. */ >> - i %= num_online_cpus(); >> + i %= cpumask_weight(mask); >> >> if (node == NUMA_NO_NODE) { >> - for_each_cpu(cpu, cpu_online_mask) >> + for_each_cpu(cpu, mask) { >> if (i-- == 0) >> return cpu; >> + } >> } else { >> /* NUMA first. */ >> - for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask) >> + for_each_cpu_and(cpu, cpumask_of_node(node), mask) { >> if (i-- == 0) >> return cpu; >> + } >> >> - for_each_cpu(cpu, cpu_online_mask) { >> + for_each_cpu(cpu, mask) { >> /* Skip NUMA nodes, done above. */ >> if (cpumask_test_cpu(cpu, cpumask_of_node(node))) >> continue; > > Are you aware of these changes to cpu_local_spread()? > https://lore.kernel.org/lkml/1582768688-2314-1-git-send-email-zhangshaokun@hisilicon.com/ > > I don't see a lot of overlap but it would be nice for you folks to Yeah, it's a different issue from Nitesh. About our's patch, it has been linux-next long time, will it be merged in Linus's tree? Thanks, Shaokun > check each other's homework ;) > > > > . >