Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp341816rwe; Wed, 24 Aug 2022 01:48:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Yn1/ZcgOeQEdTzZPNnvHFdvkMpPMD0WJLdiEhgzapxDBb7K9pX2u+NYCI5+w7jT+VJUGo X-Received: by 2002:a05:6402:2792:b0:446:8864:26c1 with SMTP id b18-20020a056402279200b00446886426c1mr6684329ede.70.1661330928017; Wed, 24 Aug 2022 01:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661330928; cv=none; d=google.com; s=arc-20160816; b=jrXVtLdrG8HULIJg/xo/qsJAmScFdOvkD2FQmxUsSemY0d2L2s48VulpXQB51dgpRc C6g4XTRTyTZfV1HGq6KcHMPkD/xiK2r0DdnF0Zd7UDk8HP+whN2Er65c3MA3r3eva0py IjRSlsPAulyGFFjrYv4hH3sNn0CqhPbsSkbZ0weytagRguUmtmRSR0MZUKtO3xhUT0xz b0hqXWGmBTRiXAzz0byK9ddBPuCMRJM1n7POGCXX5wJAQZLoBnazUpQTPnBgW2FbxfWk PQ6qAzr0znkBLQ4mbrH2Wgi6DJH9Bmez6ZDozxD+K6z246FtboA5kFwcSiR+NOG6JI3F ZRGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=/1R7cZUsc2fn/t37c3fEsagGYCq4jTZL5Wsi9k90xnQ=; b=Q3INFyLT3Wpy1ksuhQsnPoVjDKMcH31/AvJBrfZOufkSOG7cBrikUGUA171mdY9kpq SrCLrGw4kGCyXQ5rHHH1UZFWAlzhmBrU2wsfuidIV3GxLBcHV1nbN5PeK3h8kqmCKUm3 ik8T03IGniZchJ9eHz/DG2+nJZSohsTtoKtj3jHgj7yHmc04+yWFDjJizDli606D9Z90 PhSqJh40/ge+wzjGVXe8R7CPdJbR/eqwUs/Ne3MwwVfPFHfCoLdofqK/SBhweihyJY4t 6HoWEScA63lF0GFpXhu02MqB8N9gtqHrUSIbKy/uGrAvC0mws17l8gm0l1+jIRc7E37I wpqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gxSeHo2v; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=xcSrk6KP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a50d097000000b0043e151f7a5csi3484575edd.273.2022.08.24.01.48.21; Wed, 24 Aug 2022 01:48:48 -0700 (PDT) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gxSeHo2v; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=xcSrk6KP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235991AbiHXIqe (ORCPT + 99 others); Wed, 24 Aug 2022 04:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236110AbiHXIqX (ORCPT ); Wed, 24 Aug 2022 04:46:23 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73713760C0 for ; Wed, 24 Aug 2022 01:46:21 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 25AA133E2C; Wed, 24 Aug 2022 08:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661330780; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/1R7cZUsc2fn/t37c3fEsagGYCq4jTZL5Wsi9k90xnQ=; b=gxSeHo2v24f+QMBW28R3LpHR2fWzLEnk/mZuTjiBKjHcdwpVCRoLy99YGOISEPdZZfpgRc usPGkDO3G1J+f8jVwXrH/nna7soyzdiusnrvyUwQT4s3II+YMmEHIXz5CZjdexE3FItnfY iUYDWuD8SkWf3zABIkvKf73YSG+vAf8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661330780; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/1R7cZUsc2fn/t37c3fEsagGYCq4jTZL5Wsi9k90xnQ=; b=xcSrk6KPbZpuO2WzW41OGBitBZ0DUN/nwRrld99UZaP1V5IrppOzjCFu8npjE4uDa+huNx Dc9DFK9sSiNKoSDw== Received: from suse.de (unknown [10.163.43.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0FC862C141; Wed, 24 Aug 2022 08:46:18 +0000 (UTC) Date: Wed, 24 Aug 2022 09:46:14 +0100 From: Mel Gorman To: Peng Wang Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/fair: select waker's cpu for wakee on sync wakeup Message-ID: <20220824084614.kykmtbhyawcei67z@suse.de> References: <1508aa17d1a169077c8d8d8c22d2bd529101af0e.1661313074.git.rocking@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1508aa17d1a169077c8d8d8c22d2bd529101af0e.1661313074.git.rocking@linux.alibaba.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Aug 24, 2022 at 12:37:50PM +0800, Peng Wang wrote: > On sync wakeup, waker is about to sleep, and if it is the only > running task, wakee can get warm data on waker's cpu. > > Unixbench, schbench, and hackbench are tested on > Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz (192 logic CPUs) > > Unixbench get +20.7% improvement with full threads mainly > because of the pipe-based context switch and fork test. > > No obvious impact on schbench. > > This change harms hackbench with lower concurrency, while gets improvement > when concurrency increases. > Note that historically patches in this direction have been hazardous because it makes a key assumption "sync wakers always go to sleep in the near future" when the sync hint is not that reliable. Networking from a brief glance still uses sync wakeups where wakers could have a 1:N relationship between work producers and work consumers that would then stack multiple tasks on one CPU for multiple consumers. The workloads mentioned in the changelog are mostly strictly-synchronous wakeups (i.e. the waker definitely goes to sleep almost immediately) and benefit from this sort of patch but it's not necessarily a universal benefit. Note that most of these hazards occurred *LONG* before I was paying much attention to how the scheduler behaved so I cannot state "sync is still unreliable" with absolute certainty. However, long ago there was logic that tried to track the accuracy of the sync hint that was ultimately abandoned by commit e12f31d3e5d3 ("sched: Remove avg_overlap"). AFAIK, the sync hint is still not 100% reliable and while stacking sync works for some workloads, it's likely to be a regression magnet for network intensive workloads or client/server workloads like databases where "synchronous wakeups are not always synchronous". -- Mel Gorman SUSE Labs