Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp126109pxa; Thu, 13 Aug 2020 22:20:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWyyLmbLy29gLbLXOaUY3+xlCw68aZQMpB36C7iKZ8pV5Bp6EE+16OTM7OSfh1pRmQd2L1 X-Received: by 2002:a17:906:6bda:: with SMTP id t26mr886229ejs.214.1597382404140; Thu, 13 Aug 2020 22:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597382404; cv=none; d=google.com; s=arc-20160816; b=FbAJz+Dugt2mkFd6L+o1wpT5YhzJAPkoKemybgqtf5nYSrzGso0LIzYJfGQTWdH6dR fXqHhQ2uKCaBf4cxQ91QGqRTndXGg/n8fWLV4Clb0Qr1R76xH75jXieLyujeS2Uv9f4a nzoXAMfDs/3n36+yD925n2TWkr2RsRX60PLVttsXMp3/K1I51ctYWRrLypdTCBiKK374 DMyMkC5RXQtMY43zZzNMFTYCuNcsX4EAWriTOMQ20aFGoR/qW32DkbjvNp4sQg9+4Gb8 yyW4NXnd6VaGen0+NgoThThf5I4v5M8DjHPal/EgOpoOdzSxIWefghCHyeE83RDr25pE xJ1g== 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=Kym1t6MFLP66N95CDIs+rpVNLPhkvgEG5XjfNseUJGI=; b=N+eiItr+5qQO8ctK3rWuPY26UUD5IjImqG525Y0CrxcZgcdxyfwIly5QogmRQMqEqB 2SrDKDqZueI1elLaXhX+9MyOdNvOyesDcOs61onIrtsTd4U636wc70VGh2Q1j73zJP79 5YNrre9c5/BD8h31p81u8M+s7nFt7gUv3jm20OezVVlmMK+ua24Zt1fPeLpFTWWiBf5v WmEcjkPvH31xioVDtXBa5KLSwDJA22uUcn8QBPFqVk6OSZzSzXDlcsHMT3Q50CQ1wi3C rBVVjm6t6fwDtLQYdsphwxGkEpKVAY4BvEBJzGr5nQCr+Rabm17D8a9XhZvUUfuLaud7 ukqA== 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 a18si5133300ejr.616.2020.08.13.22.19.41; Thu, 13 Aug 2020 22:20:04 -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 S1726140AbgHNFSK (ORCPT + 99 others); Fri, 14 Aug 2020 01:18:10 -0400 Received: from mga04.intel.com ([192.55.52.120]:65440 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbgHNFSK (ORCPT ); Fri, 14 Aug 2020 01:18:10 -0400 IronPort-SDR: 9WPhhedK0i03mCWO2yt/54idOG65O+ScOAXe4X/nJbjYgsB05plAYH9aFGu2yHK+UMxTrvZYty uDTIvNd8Ds3A== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="151773961" X-IronPort-AV: E=Sophos;i="5.76,311,1592895600"; d="scan'208";a="151773961" 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 22:18:09 -0700 IronPort-SDR: AtRzbQvay8Kd0BLezy/923tIK69BjTo82BJho3OinqGvljQ+y5zpDVbUpD4M6czzA5PN4/0SbK Wc9Mp99OAl/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,311,1592895600"; d="scan'208";a="318773271" 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 22:18:02 -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> <89d973d1-1302-17a6-c647-ea7c538c2747@linux.intel.com> <18263ED7-88B3-4DED-9714-55D9D2EB69D9@tencent.com> From: "Li, Aubrey" Message-ID: <97a82444-77ab-dbd2-f765-0d818f94ca0b@linux.intel.com> Date: Fri, 14 Aug 2020 13:18:02 +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: <18263ED7-88B3-4DED-9714-55D9D2EB69D9@tencent.com> 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 12:04, benbjiang(蒋彪) wrote: > > >> On Aug 14, 2020, at 9:36 AM, Li, Aubrey wrote: >> >> 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. > That’s right. :) > Could we set the cookie of cgroup where uperf lies to 0? > IMHO the disadvantage is that if there are two or more cgroups set cookie-0, then the user applications in these cgroups could run concurrently on a core, though all of them are set as trusted, we made a hole of user->user isolation. Thanks, -Aubrey