Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp37553pxa; Thu, 13 Aug 2020 18:39:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7Qt7OaXNqdbDihOj9379CUJ4fBSLXVMXngPzk6KQlwIhILDL/lsUn57gS3DdHT+elyb3I X-Received: by 2002:a05:6402:2216:: with SMTP id cq22mr153717edb.294.1597369190397; Thu, 13 Aug 2020 18:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597369190; cv=none; d=google.com; s=arc-20160816; b=oMlbEGtAYJgwS5ec4pqS9GwTLN/HHOXYpGgxirMHx8LI31LZXw0AlkDGpmudsK5BDZ xYuVFa/pb/S1Um6daypBq3AjZGrk+Pd8FYKPnsVlxVWO85AgmxrjCTdf2YwCi22kratc m5xSLWKEcUfIn5RZkGs4FGvW0ics/9bjFVVVn2SU77lvE1DtUKTPzUmHSb36ikelkCTG H9z2/3InMHBwh/Wlg9yIoUzHbjOs5UhsFeb8Y9jUpHOg+VYkVu0V6fQMODuOClUxjuft i60klsWVAivB5z5IaLiC3W9NQj9ReRA3wEPuxB/ImsE9scRZ4Lql9/PUQgiMHfLqPYs0 w2Jw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=HACNhhSwjEv9h+LhpSXE5xkUyf1V2c561x4CwAUthjE=; b=FQ7mfinESYRDftYuPuWM0fjYGeAy5npbuE8jVP64CVFvT412RIvcpNFiTfJFt71Cm2 OnTFCO0xoURqQG9w6/GBhXuX+hOsdeokK0RcOiH/dO/iYR2Lz9KdB3B2JRzkUpvbza1l xutS8bOVpYHbDjhn+xtaX2MdjUh/jVJjfU05xE54c1HOYeiJSxUGjUTlnNwRbutliv5U pehbjUdmp9oqfqdYBzrrx/SieY2l8aguH9rJMWZf0A40LQ4lUVptz7uNa9eZVv3oWf8P 86RHdlerHOSSBg1d7H3t0dfTkB8dvyhcD0bXVZrPjFWsy62ADWsl5+LUkgffvvjVutmp /wRw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be25si4469317edb.124.2020.08.13.18.39.26; Thu, 13 Aug 2020 18:39:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726574AbgHNBg3 (ORCPT + 99 others); Thu, 13 Aug 2020 21:36:29 -0400 Received: from mga04.intel.com ([192.55.52.120]:46692 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbgHNBg3 (ORCPT ); Thu, 13 Aug 2020 21:36:29 -0400 IronPort-SDR: SWEXMVFwTrVhTfOn2yELP+G+wRC1lepQqqW+X816L4o17VZ4SCeVaO/6WEnuAAoUuTC+QLB6VT NlXNy2DyXDZg== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="151759767" X-IronPort-AV: E=Sophos;i="5.76,310,1592895600"; d="scan'208";a="151759767" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 18:36:30 -0700 IronPort-SDR: RnjJdHjxXUEuoIsx4JPCo3Gi6lPtlB//y4TB5EWDyRF6ScrmQVCiHocTI00gAkTNaS8+4q5wxH 4aDjCDHNigFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,310,1592895600"; d="scan'208";a="318725240" Received: from cli6-desk1.ccr.corp.intel.com (HELO [10.239.161.135]) ([10.239.161.135]) by fmsmga004.fm.intel.com with ESMTP; 13 Aug 2020 18:36:23 -0700 Subject: Re: [RFC PATCH 00/16] Core scheduling v6(Internet mail) To: =?UTF-8?B?YmVuYmppYW5nKOiSi+W9qik=?= Cc: Joel Fernandes , "viremana@linux.microsoft.com" , Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , Ingo Molnar , Thomas Glexiner , Paul Turner , Linus Torvalds , LKML , Subhra Mazumdar , Frederic Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Aaron Lu , Aubrey Li , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Vineeth Pillai , Chen Yu , Christian Brauner , "Ning, Hongyu" References: <6d0f9fc0-2e34-f559-29bc-4143e6d3f751@linux.intel.com> <20200809164408.GA342447@google.com> <162a03cc-66c3-1999-83a2-deaad5aa04c8@linux.intel.com> <20200812230850.GA3511387@google.com> <5a39735d-dfd8-bdec-f068-81895799640e@linux.intel.com> From: "Li, Aubrey" Message-ID: <89d973d1-1302-17a6-c647-ea7c538c2747@linux.intel.com> Date: Fri, 14 Aug 2020 09:36:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/14 8:26, benbjiang(蒋彪) wrote: > > >> On Aug 13, 2020, at 12:28 PM, Li, Aubrey wrote: >> >> On 2020/8/13 7:08, Joel Fernandes wrote: >>> On Wed, Aug 12, 2020 at 10:01:24AM +0800, Li, Aubrey wrote: >>>> Hi Joel, >>>> >>>> On 2020/8/10 0:44, Joel Fernandes wrote: >>>>> Hi Aubrey, >>>>> >>>>> Apologies for replying late as I was still looking into the details. >>>>> >>>>> On Wed, Aug 05, 2020 at 11:57:20AM +0800, Li, Aubrey wrote: >>>>> [...] >>>>>> +/* >>>>>> + * Core scheduling policy: >>>>>> + * - CORE_SCHED_DISABLED: core scheduling is disabled. >>>>>> + * - CORE_COOKIE_MATCH: tasks with same cookie can run >>>>>> + * on the same core concurrently. >>>>>> + * - CORE_COOKIE_TRUST: trusted task can run with kernel >>>>>> thread on the same core concurrently. >>>>>> + * - CORE_COOKIE_LONELY: tasks with cookie can run only >>>>>> + * with idle thread on the same core. >>>>>> + */ >>>>>> +enum coresched_policy { >>>>>> + CORE_SCHED_DISABLED, >>>>>> + CORE_SCHED_COOKIE_MATCH, >>>>>> + CORE_SCHED_COOKIE_TRUST, >>>>>> + CORE_SCHED_COOKIE_LONELY, >>>>>> +}; >>>>>> >>>>>> We can set policy to CORE_COOKIE_TRUST of uperf cgroup and fix this kind >>>>>> of performance regression. Not sure if this sounds attractive? >>>>> >>>>> Instead of this, I think it can be something simpler IMHO: >>>>> >>>>> 1. Consider all cookie-0 task as trusted. (Even right now, if you apply the >>>>> core-scheduling patchset, such tasks will share a core and sniff on each >>>>> other. So let us not pretend that such tasks are not trusted). >>>>> >>>>> 2. All kernel threads and idle task would have a cookie 0 (so that will cover >>>>> ksoftirqd reported in your original issue). >>>>> >>>>> 3. Add a config option (CONFIG_SCHED_CORE_DEFAULT_TASKS_UNTRUSTED). Default >>>>> enable it. Setting this option would tag all tasks that are forked from a >>>>> cookie-0 task with their own cookie. Later on, such tasks can be added to >>>>> a group. This cover's PeterZ's ask about having 'default untrusted'). >>>>> (Users like ChromeOS that don't want to userspace system processes to be >>>>> tagged can disable this option so such tasks will be cookie-0). >>>>> >>>>> 4. Allow prctl/cgroup interfaces to create groups of tasks and override the >>>>> above behaviors. >>>> >>>> How does uperf in a cgroup work with ksoftirqd? Are you suggesting I set uperf's >>>> cookie to be cookie-0 via prctl? >>> >>> Yes, but let me try to understand better. There are 2 problems here I think: >>> >>> 1. ksoftirqd getting idled when HT is turned on, because uperf is sharing a >>> core with it: This should not be any worse than SMT OFF, because even SMT OFF >>> would also reduce ksoftirqd's CPU time just core sched is doing. Sure >>> core-scheduling adds some overhead with IPIs but such a huge drop of perf is >>> strange. Peter any thoughts on that? >>> >>> 2. Interface: To solve the performance problem, you are saying you want uperf >>> to share a core with ksoftirqd so that it is not forced into idle. Why not >>> just keep uperf out of the cgroup? >> >> I guess this is unacceptable for who runs their apps in container and vm. > IMHO, just as Joel proposed, > 1. Consider all cookie-0 task as trusted. > 2. All kernel threads and idle task would have a cookie 0 > In that way, all tasks with cookies(including uperf in a cgroup) could run > concurrently with kernel threads. > That could be a good solution for the issue. :) From uperf point of review, it can trust cookie-0(I assume we still need some modifications to change cookie-match to cookie-compatible to allow ZERO and NONZERO run together). But from kernel thread point of review, it can NOT trust uperf, unless we set uperf's cookie to 0. Thanks, -Aubrey