Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp917030ybl; Thu, 12 Dec 2019 06:57:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzF4aFJbwc9oedzYDzWYE14MaJ+29A7/3MgcJ96I2yl2B9pTLtJWhyNLdbXWS9HoFCabJJs X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr8080734otd.372.1576162661834; Thu, 12 Dec 2019 06:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576162661; cv=none; d=google.com; s=arc-20160816; b=NiVnHqwQqB83wym1BaO6/jeO3hNgJ/p2jJzseOlybuFNsxFtrF1DOgQiPjIlnlWQx4 cwRvYJtG7+Z/vpi+zqZRahKS/MOLAeigEEjLmJohxssu00t9xsNX3u4N4rY/qBiR2CfM mbnm1vNKpQ1WRtGH0Q1zRcjBEvU4+8qndJD9hnzgejFT+igQq0G4C6YzCDh59w+ansPR ifoT73AxFYwlErJDzIQwRXg8opA3t1sJI+2Vr18aF4rHqMFt36XIz0UVe4SjqwezZZ8w iBkA/PxubNjfdI2aUQ5tHNAVfXdTHNl2ngtG161U0DZMIClZlt2DrtUnjf+WAx1Isgjk egRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=pMhje3na1tw3gwOVv7lv6pnoyXN59YbaKb49VID/1sg=; b=tHECJoymRmB1ME3XjiorL5CocBV1AFiDVJCf7uF0vI3ujpXKEN3zKZufMMtFlYdGQA wCbF3afnOZS+/Rwj7D+K8GQn3388++IhS7cOppJrNFOk697ziufq0/DQTG+FG0OUX1bf PE4QTq4qxceubqnuaDa6LODUc8KeIYyrMwHFXjDP3aFUj3HxsBwYbBrE24z+B0ZbsdEU nTasQyCLGDlBBbH39LKZkXdsIKx6vwT0Aze38XDqkRaDff2MRCqS6jZVaIEsiJ0ffFUk pWDRBwGeTeCDaZznTY12omJ7JOwHZVFLfvqxS3QOynFIdj+UaWB9hs7e88YuE6PX56zo lTPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si3424680otg.128.2019.12.12.06.57.28; Thu, 12 Dec 2019 06:57:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728962AbfLLO4z (ORCPT + 99 others); Thu, 12 Dec 2019 09:56:55 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7680 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728861AbfLLO4z (ORCPT ); Thu, 12 Dec 2019 09:56:55 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 14B6EA39E3995B3780DE; Thu, 12 Dec 2019 22:56:49 +0800 (CST) Received: from [127.0.0.1] (10.133.217.236) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Thu, 12 Dec 2019 22:56:39 +0800 Subject: Re: [PATCH] sched/fair: Optimize select_idle_cpu To: , , CC: , , , , , , , "chengjian (D)" References: <20191212144102.181510-1-cj.chengjian@huawei.com> From: "chengjian (D)" Message-ID: <3cf0931f-d2f4-008e-8e58-cbc9bd45e3a6@huawei.com> Date: Thu, 12 Dec 2019 22:56:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20191212144102.181510-1-cj.chengjian@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.133.217.236] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/12 22:41, Cheng Jian wrote: > Our threads are all bind to the front CPUs of the LLC domain, > and now all the threads runs on the last CPU of them. nr is > always less than the cpumask_weight, for_each_cpu_wrap can't > find the CPU which our threads can run on, so the threads stay > at the last CPU all the time. Test : Run on ARM64 4NODE, 128 CORE // cat a.c #include int main(void) {     struct timespec time, save;     int ret;     time.tv_sec = 0;     time.tv_nsec = 1;     while (1) {         ret = nanosleep(&time, &save);         if (ret)             nanosleep(&save, &save);     }     return 0; } #cat a.sh for i in `seq 0 9` do     taskset -c 8-11 ./a.out & done then run:     gcc a.c -o a.out     sh a.sh without this patch, you can see all the task run on CPU11 all the times.     %Cpu8  :  0.0 us,  0.0 sy,  0.0 ni, 98.4 id,  0.0 wa,  1.6 hi, 0.0 si,  0.0 st     %Cpu9  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi, 0.0 si,  0.0 st     %Cpu10 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi, 0.0 si,  0.0 st     %Cpu11 :  5.7 us, 40.0 sy,  0.0 ni, 45.7 id,  0.0 wa,  8.6 hi, 0.0 si,  0.0 st