Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp951141iob; Fri, 13 May 2022 17:30:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQZIovrBVfUqtFfeIhJorOm2X4WBOvc+GARINzjbXuzbWEXBLMUB+RHRLy3eVaYzVSeOoc X-Received: by 2002:a05:600c:4e13:b0:394:797e:3358 with SMTP id b19-20020a05600c4e1300b00394797e3358mr17077840wmq.30.1652488220168; Fri, 13 May 2022 17:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652488220; cv=none; d=google.com; s=arc-20160816; b=ItWh4FH8usDEGFelRWz1qEra9eAv6u8PrU6tdxSkT9dcWCiUzCCvhWpVoiyuLBkBby 3cT/1U5mAoDOGiM3rku8DRzkF/RcCVZWabhXeyeyak3jEOMFDxM9wT4DQ/16aJI010EB DkKNJ4hT9ivqC4t5OMYxwWfGmGPk06tKvW84PdEHCB0MmOmLouqfjOJnLt3tTv9tCDPr eMLbl5DnPa/owIPUyhtTt3iZINrSlNHzhel541Wd4Q4cXP4UbV9cSnwENPCWggIUtji4 L7GlhTPcwtMNenC4M2mGh+N8EBricEzDJ+0cKcpz8KNLZgRhmC2bgStKK+fMidmOaAyX rfFg== 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; bh=5vIa0xXv2MZvKJIGM7qBkzCdZsrYxdHApZywUtBMqLY=; b=iqiHErdy+dPso2yULgMZGSE5OYi/xOt9p1u7tjAZAmN0RXKa51439qHnkbTcePDitk CXm5qEBL4zlo3k2ZmAgEAk6Im3Eqr+3o8GmvYrKiFtvO48agOJIakYABi6YwkUyrnk+Y KbXQ7ZeVMLbbEuFjDY04tPiTMuQBijLZgSLtYiopHnOOGUychhI2KDZYCmDphJaLkpig 2B+4PLajOOAGLzk5Q2k6G2m9dgtJ747kTyanFUK2dnM8DRZg4jsOEyd2lO96WHhQV5b/ 9GcFKWfLXws6kSkine4+wbf170g0AwstJdcQ1Lnaz04YcQlnbxR2n6C89FZfMeTcYpzJ MfZg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e7-20020a5d5947000000b0020a878263f9si3195273wri.457.2022.05.13.17.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:30:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEB49304B37; Fri, 13 May 2022 16:21:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377657AbiEMHFg (ORCPT + 99 others); Fri, 13 May 2022 03:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377655AbiEMHFe (ORCPT ); Fri, 13 May 2022 03:05:34 -0400 Received: from out199-12.us.a.mail.aliyun.com (out199-12.us.a.mail.aliyun.com [47.90.199.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8413429BC6D for ; Fri, 13 May 2022 00:05:32 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=dtcccc@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VD24UDT_1652425525; Received: from 30.30.111.38(mailfrom:dtcccc@linux.alibaba.com fp:SMTPD_---0VD24UDT_1652425525) by smtp.aliyun-inc.com(127.0.0.1); Fri, 13 May 2022 15:05:27 +0800 Message-ID: Date: Fri, 13 May 2022 15:05:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [RFC PATCH] sched: Queue task on wakelist in the same llc if the wakee cpu is idle Content-Language: en-US To: Peter Zijlstra Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org References: <20220513062427.2375743-1-dtcccc@linux.alibaba.com> <20220513063729.GF76023@worktop.programming.kicks-ass.net> From: Tianchen Ding In-Reply-To: <20220513063729.GF76023@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable 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 On 2022/5/13 14:37, Peter Zijlstra wrote: > On Fri, May 13, 2022 at 02:24:27PM +0800, Tianchen Ding wrote: >> We notice the commit 518cd6234178 ("sched: Only queue remote wakeups >> when crossing cache boundaries") disabled queuing tasks on wakelist when >> the cpus share llc. This is because, at that time, the scheduler must >> send IPIs to do ttwu_queue_wakelist. > > No; this was because of cache bouncing. As I understand, avoiding cache bouncing is the reason to do queue_wakelist accross llc. This can be the same reason why we try to do queue_wakelist within the same llc now. It should be better for the wakee cpu handling its own rq. Will there be some other side effects? > >> Nowadays, ttwu_queue_wakelist also >> supports TIF_POLLING, so this is not a problem now when the wakee cpu is >> in idle polling. >> >> Benefits: >> Queuing the task on idle cpu can help improving performance on waker cpu >> and utilization on wakee cpu, and further improve locality because >> the wakee cpu can handle its own rq. This patch helps improving rt on >> our real java workloads where wakeup happens frequently. >> >> Does this patch bring IPI flooding? >> For archs with TIF_POLLING_NRFLAG (e.g., x86), there will be no >> difference if the wakee cpu is idle polling. If the wakee cpu is idle >> but not polling, the later check_preempt_curr() will send IPI too. >> >> For archs without TIF_POLLING_NRFLAG (e.g., arm64), the IPI is >> unavoidable, since the later check_preempt_curr() will send IPI when >> wakee cpu is idle. >> >> Benchmark: >> running schbench -m 2 -t 8 on 8269CY: >> >> without patch: >> Latency percentiles (usec) >> 50.0000th: 10 >> 75.0000th: 14 >> 90.0000th: 16 >> 95.0000th: 16 >> *99.0000th: 17 >> 99.5000th: 20 >> 99.9000th: 23 >> min=0, max=28 >> >> with patch: >> Latency percentiles (usec) >> 50.0000th: 6 >> 75.0000th: 8 >> 90.0000th: 9 >> 95.0000th: 9 >> *99.0000th: 10 >> 99.5000th: 10 >> 99.9000th: 14 >> min=0, max=16 >> >> We've also tested unixbench and see about 10% improvement on Pipe-based >> Context Switching, and no performance regression on other test cases. >> >> For arm64, we've tested schbench and unixbench on Kunpeng920, the >> results show that, > > What is a kunpeng and how does it's topology look? It's an arm64 processor produced by Huawei. It's topology has NUMA and cluster. See the commit log of c5e22feffdd7 ("topology: Represent clusters of CPUs within a die") for detail. In fact I also tried to test on Ampere. But there maybe sth wrong on my machine and the kernel only get upto l2 cache info. (Which means each cpu has a different sd_llc_id so the patch will take no effect.) :-( > >> the improvement is not as obvious as on x86, and >> there's no performance regression. > > x86 is wide and varied; what x86 did you test? I've tested on Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz. Do you need more info on other machines?