Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp682891yba; Mon, 1 Apr 2019 14:40:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDjkkmPCFqqCdctDoLMtsqBcYP8peAIxeBp3syZbzbcwQlet2SN/cG/Cgu/Zn/1XjQwFeL X-Received: by 2002:aa7:8518:: with SMTP id v24mr64605978pfn.219.1554154834586; Mon, 01 Apr 2019 14:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554154834; cv=none; d=google.com; s=arc-20160816; b=LYS7mrx+humj7CpgGB3EXsYLAUaSaHP1vLJlAkaz6IxUhJ+EkPjZxiF6dWe0RAyWLq vaZJr/DTF7glrgackz2fiauHcpAIiuTR/fFdMSWv6l0CrxdHmp4bDE7l/bGcHAgxKMlT xsb4OeAL9vFi+4HB6AFcj9aiYbMZSKH9IhJXG3S03L7c09AelCd/vRKHpyiQFcUMDUe5 qX7PZBqph8dqTU1JMKkyu5bdOrp3alTIsix2f730xbPZ3wFcTJYvF+MuclBwZ7XNhQ2p VAMDsPBlUn9oscmoqv5hcHVkYKONfTwNy7G5RFY8R4A7pDt7Jh31vNHiql5QRV+8AQnS j1kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=XfDzD4vAZC/JVATNC4UDEF7mqisZp7Wn46lAtr7gXvw=; b=bS8hf9S8EBFejobpF8++Fmx7NctzC5aMi/5UDrOyelqO+fS/uQTPl9KmRWalY4XXBm XRlKDbcPWIqPvHudagZtJEZiSPMylP64TumsoR+sYkL9GF14GdChlHKD0nZcwEUuD1Dd x4qH8DVXNhWoNtpFAQt5hyiW3/00o5quRasTOEV4ezE3B19wYTEvPFwxnVgcX43GOZJR 8PJECk7STBwFa9Sq/6FTVcHsBGhh+2liTmUUtxKvKwUBLIe4ZzHRSkModwlxBTkIq/2i oCE3kxwOPvaLr2OpoRS9bxbqLLdv4W0ovcAULRCS+WSypzr8z5aFsqAq0GwBWBUo8qkb I//g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=tJaYRICc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 66si9876164plc.88.2019.04.01.14.40.17; Mon, 01 Apr 2019 14:40:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=tJaYRICc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728645AbfDAVjg (ORCPT + 99 others); Mon, 1 Apr 2019 17:39:36 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50376 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbfDAVje (ORCPT ); Mon, 1 Apr 2019 17:39:34 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x31LXxVH165824; Mon, 1 Apr 2019 21:39:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=XfDzD4vAZC/JVATNC4UDEF7mqisZp7Wn46lAtr7gXvw=; b=tJaYRICcdXgHGPqGCJhJ9X2EgLsLtmBQ8gPhqJek1KBYd8gJ0DhyKJKBEVihKUItgsh2 QlrSnpWl1WFe/hbKZ26GMjELUfFkxLZlbhbld8NOsU5/EDa75OJm2UnO3klih6JbVcPw Toe0I3KUfDlcPfjZ9YRJJGVQFy1VbdyJGMszRpLGcwioWS7eYjDh1HJp5sCzkn/dS6lm Sx3YYTDv3YFBbuqlCeAvFVngwMS748+HJU31UdJVyFCgTbeRitMor9BoUQmHActmy1iO hYFvgXM2lBCAJ5e1q6aOks6LAd0jqRgpba3BSkK3lZ3HFjKXk9qtLuLkLKEoLyZx3FM9 VA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2rj13q1h6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Apr 2019 21:39:03 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x31LctKZ004678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Apr 2019 21:38:56 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x31LcsxO025394; Mon, 1 Apr 2019 21:38:54 GMT Received: from [10.132.91.175] (/10.132.91.175) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Apr 2019 14:38:54 -0700 Subject: Re: [RFC][PATCH 03/16] sched: Wrap rq::lock access From: Subhra Mazumdar To: Julien Desfossez Cc: Peter Zijlstra , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Vineeth Pillai , Nishanth Aravamudan References: <1553866527-18879-1-git-send-email-jdesfossez@digitalocean.com> <6e8e6fa0-8976-5e97-d90c-af0b4a6fc8b2@oracle.com> Message-ID: Date: Mon, 1 Apr 2019 14:35:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <6e8e6fa0-8976-5e97-d90c-af0b4a6fc8b2@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9214 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904010139 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/29/19 3:23 PM, Subhra Mazumdar wrote: > > On 3/29/19 6:35 AM, Julien Desfossez wrote: >> On Fri, Mar 22, 2019 at 8:09 PM Subhra Mazumdar >> >> wrote: >>> Is the core wide lock primarily responsible for the regression? I ran >>> upto patch >>> 12 which also has the core wide lock for tagged cgroups and also calls >>> newidle_balance() from pick_next_task(). I don't see any >>> regression.  Of >>> course >>> the core sched version of pick_next_task() may be doing more but >>> comparing with >>> the __pick_next_task() it doesn't look too horrible. >> On further testing and investigation, we also agree that spinlock >> contention >> is not the major cause for the regression, but we feel that it should >> be one >> of the major contributing factors to this performance loss. >> >> > I finally did some code bisection and found the following lines are > basically responsible for the regression. Commenting them out I don't see > the regressions. Can you confirm? I am yet to figure if this is needed > for > the correctness of core scheduling and if so can we do this better? > > -------->8------------- > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index fe3918c..3b3388a 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3741,8 +3741,8 @@ pick_next_task(struct rq *rq, struct task_struct > *prev, struct rq_flags *rf) >                                  * If there weren't no cookies; we > don't need >                                  * to bother with the other siblings. > */ > -                               if (i == cpu && !rq->core->core_cookie) > -                                       goto next_class; > +                               //if (i == cpu && !rq->core->core_cookie) > +                                       //goto next_class; > > continue; >                         } AFAICT this condition is not needed for correctness as cookie matching will sill be enforced. Peter any thoughts? I get the following numbers with 1 DB and 2 DB instance. 1 DB instance users  baseline   %idle  core_sched %idle 16     1          84     -5.5% 84 24     1          76     -5% 76 32     1          69     -0.45% 69 2 DB instance users  baseline   %idle  core_sched %idle 16     1          66     -23.8% 69 24     1          54     -3.1% 57 32     1          42     -21.1%      48