Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5105083iob; Mon, 9 May 2022 08:42:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXDEpiafLVs5X7oy5Y+j40ofxt9wvWlupphOpB3IBsWwo1Gt0Vyac6V7rvtIYYIFupNJ/g X-Received: by 2002:a62:1613:0:b0:510:82a9:e3bf with SMTP id 19-20020a621613000000b0051082a9e3bfmr15434207pfw.23.1652110953383; Mon, 09 May 2022 08:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652110953; cv=none; d=google.com; s=arc-20160816; b=BANT/YaH5E3xbIVVmG5hsSj1HOfAoSGvXA2WG1DcHFuLCFw9F/Tui3i+1GG9PshfDU 0jUMChIZfeL0kt7aZ38P/SfEeKqdza5FPCqD0WF3dba4x9xgsSlvd4eQbzEafnDJJAvZ lXH3xe8zMWvYQiOtJmc5AwLyif4PvI+X85hyfUDdF/5nQiHx5gZEJOWCgGsWCM9EWSaz CJqVTaRQPYrTCWC84lkhe8YYJPOgYgPqiKI9ppE4SBgkZ503AwnHO+o73uSJCxqCGlw+ FV3lBTKi04S9lf53BQXNpHk48/fIKbQqnHpB8B9bniGLtgBRM0E/Xwu7KjHsKBuwYvtG GRUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RF6NlJgBC2duKXQ/qm8aP7sq/2Tq7ZiMGqrzTmGWNqU=; b=TpXb/8bzqLgEtn365aBynkeAuSE4uAc1d8Z8OuU1M0Xcg7qyJSvyq5ksSXkCB2CTOm APWBdlDM2CQyUW0oOfTRuHZDjWljXIzUys9BXpzgX+9zIqYQaZvE56JfGen1NBwcxVZn 9/VXuVHFunFbGUVU+sE0tdweZL3b9v3JvV+GoazzQzpJnOGedNsNQ2hyaykqh0a+nUTE ql+jqMce30BpYkYircju6gH4gDFilw+z/FpUBeUg+S7F96fLnJbuKhCXDkVwA3yIaJuI eYVEvb3SJcpZdzUZ8rKCT+6wq0ITP26h9/vfDbQImQeFVGPIQwK6mmRzMlAnOsNOpToA GBSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pa3FHCoG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p20-20020a170902ead400b00156b765043fsi10784121pld.389.2022.05.09.08.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 08:42:33 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pa3FHCoG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 492E51BDD9E; Mon, 9 May 2022 08:31:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238353AbiEIPfc (ORCPT + 99 others); Mon, 9 May 2022 11:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238342AbiEIPf2 (ORCPT ); Mon, 9 May 2022 11:35:28 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3D714677D for ; Mon, 9 May 2022 08:31:33 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id y2so25600216ybi.7 for ; Mon, 09 May 2022 08:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RF6NlJgBC2duKXQ/qm8aP7sq/2Tq7ZiMGqrzTmGWNqU=; b=pa3FHCoGa+7oq2sUGs7BEuDitGhL3+5eQHvzemtAVZKt9B3hGPB9JL0mKMHVpySsKF ix9tDji4hV6ZarBd/2WiUVrE5ujAFKMi+WD/i46ImLcUtjQRYrR1NGa0P7Yum8D7tkav +w5FehzivW1Jd5jyq8bhuEJkX4X70bwNctHW7md8YKOw8H5gZOXj6mNJChYrH5eSWLf6 aLeW2ULDZwd46rkLVUbXKKQ/eQ8DqQcFBF2V4rJgLLWcBLe8WWTOfP/HO2gW9Agy3FqE cDx6xTWSeArTrAKLRlaBa52GgZFTswYWgxgo5NE8KQX0XW1ZwvbLx7KcahzY5RzljmC8 AVxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RF6NlJgBC2duKXQ/qm8aP7sq/2Tq7ZiMGqrzTmGWNqU=; b=clfdTDGbvJFhscxCe05+I4v5N+cBKZvuLgj2/aVCidZK3gpbX04YYVdFD/dFBobXhU UMyJ9S9XvwI+Tt6l6YLCUN2VpI8nG0agQhPdymlIKFkxINeQ/5pjZIrsR3vACXKEdt3a ZtBGxM7FNHqRUrsCxzjajgbJ4m0oQ66/Av2dBvEjiKvTmmjON+V10OO0IFrXDa/EB3xp wFPnXtiZnXrUe7oIkV5Km2420EHxJ8trPGKuZPymrqqagwdr/HXa7SF/+p30J21BcYez r3XyenQsyWZiSIe4MCJz7PeC/Gs++RYxFjLeMkWt1A8wyhLBC0fvyKjnLwB4bVpvNTtE NCyw== X-Gm-Message-State: AOAM531itpmzwo69ffBvWjAbg2Ctz6OA2aJ/M72NBE+x0aBsQ8kO1rNy I8wplr4yZp7+zSagL5VDwnphS7N9MZs4wgUFWZ0= X-Received: by 2002:a25:e7c5:0:b0:64a:718d:2f78 with SMTP id e188-20020a25e7c5000000b0064a718d2f78mr12838239ybh.564.1652110292668; Mon, 09 May 2022 08:31:32 -0700 (PDT) MIME-Version: 1.0 References: <20220505122331.42696-1-wuyun.abel@bytedance.com> <53fcde27-7dd2-5150-633b-4e2acc37bb6f@bytedance.com> In-Reply-To: From: Chen Yu Date: Mon, 9 May 2022 23:31:21 +0800 Message-ID: Subject: Re: [PATCH v3] sched/fair: filter out overloaded cpus in SIS To: Abel Wu Cc: Peter Zijlstra , Mel Gorman , Vincent Guittot , Josh Don , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, May 9, 2022 at 11:21 PM Chen Yu wrote: > > On Sun, May 8, 2022 at 1:50 AM Abel Wu wrote: > > > > Hi Chen, > > > > On 5/8/22 12:09 AM, Chen Yu Wrote: > [cut] > > >> @@ -81,8 +81,20 @@ struct sched_domain_shared { > > >> atomic_t ref; > > >> atomic_t nr_busy_cpus; > > >> int has_idle_cores; > > >> + > > >> + /* > > >> + * Tracking of the overloaded cpus can be heavy, so start > > >> + * a new cacheline to avoid false sharing. > > >> + */ > > > Although we put the following items into different cache line compared to > > > above ones, is it possible that there is still cache false sharing if > > > CPU1 is reading nr_overloaded_cpus while > > > CPU2 is updating overloaded_cpus? > > > > I think it's not false sharing, it's just cache contention. But yes, > > it is still possible if the two items mixed with others (by compiler) > > in one cacheline, which seems out of our control.. > > > My understanding is that, since nr_overloaded_cpus starts with a new > cache line, overloaded_cpus is very likely to be in the same cache line. > Only If the write to nr_overloaded_cpus mask is not frequent(maybe tick based > update is not frequent), the read of nr_overloaded_cpus can survive from cache > false sharing, which is mainly read by SIS. I have a stupid thought > that if nr_overloaded_cpus > mask and nr_overloaded_cpus could be put to 2 cache lines. Not exactly, as overloaded_cpus and nr_overloaded_cpus are updated at the same time, it is not a false sharing case. -- Thanks, Chenyu