Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4818741img; Tue, 26 Mar 2019 18:07:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2PST9Z/GH7HPKu50vKXj8u8ZNe9h46I7yRMZnvncd3VOWYIjQTReQTEJlG3oLPYK9nrCW X-Received: by 2002:a17:902:59c5:: with SMTP id d5mr602806plj.104.1553648825382; Tue, 26 Mar 2019 18:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553648825; cv=none; d=google.com; s=arc-20160816; b=ZnMJRz6VFGWXQaT8X2ZIPvURPtvFur5L9p6uyLBlNCObC2f0M6KskM6lM2sx9+O+Rr +3Wawwn2cb/nbY6B9VFFKlM/E+3wRmUe0T+l+eiw0aqzs97/v+bRGlIFPERtiAokP/8c Zl5FpuomjygmTtneIONKYAOl0Rsv5uioJp4h7c8U3Gs2nVc8G5a21JGtUAt3zBECQk3s nmax7GV6oOfvWrZS+9EarjlJ5EQKF4al2EZL47CseoDh37Wc4sE9bUcFadH9v8NGYmtt mLMB2gJ29RH5CPNOaBXd4e82hJxQn/IztxSguizPiVDME3z1oT0dw/TH41/zJVYPY7ab +c6w== 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=xv7qfhVwgdgLQui6tb9/wDjghiE85riLDriiMP9tn7Q=; b=lBjAfOkhR33F1yIC4SeFqFyn2IG5ItzCxTM8eUtYhxL/pawlko/qcW0KGsuPdInwXE h21CugLtopoppnchxDqbsA53likVgLbkkSatOVe5N9vn8tRFhSW5JwriIKkhs0T9PEHP oY/wVMymAa4MWllIUoMMhQ2OOevyZXwD0H6PpclsuGDygUEsxL4DnHzSSz+/SxvTKfbV fTdB8q/ZXo/4R/4vWJi4y/nIFKnZNwcRsk0tr0h7Ss0eIrYF8tfQ30AEQnxKxEloG2AR wpGyIzOy4VDzJTwVvTtHmvD4EVnT8Oyii6GkY5ndOI4NKN1lBHlkjTwqyhU+9r/ApiZ0 MoDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="kteY/gOR"; 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 65si18401670plf.288.2019.03.26.18.06.50; Tue, 26 Mar 2019 18:07:05 -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="kteY/gOR"; 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 S1732267AbfC0BFm (ORCPT + 99 others); Tue, 26 Mar 2019 21:05:42 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:51850 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730333AbfC0BFl (ORCPT ); Tue, 26 Mar 2019 21:05:41 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2R0xRfW011541; Wed, 27 Mar 2019 01:05:10 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=xv7qfhVwgdgLQui6tb9/wDjghiE85riLDriiMP9tn7Q=; b=kteY/gOR+kVIO7T8CEa5hoNpegQdgsP0a9bmzHV4VzEd8BAKxIXXWDKDMGk5nJfJHe1D mzz4byHXWwhi0GlP0m/JfMoZ52iAM+xSzL0uw4gNb+j25vJ9sqg73Uypev6q6cSw6MaU 3yG9qSexs7PresDUzLNCpqy3YsKJkBQpChqCm+gRO3i4Ne9v4GysaqPHshwU79ByOA2d fccaRCSiwwLxZYMfIcZwSn2BmUfZZ2rbrHu3LKfY7bKYpxvwZAoxR7/hdP4sqFlpAjd/ ChhRPJUGhTFGku+4aPZ+wukhFtDx2wB8mcqHONTqBwRTu4Ima2CFC/zSPD1apMYgVHRY iQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2re6g15ns4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 01:05:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2R15AGT007800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 01:05:10 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2R158rn022579; Wed, 27 Mar 2019 01:05:08 GMT Received: from [10.132.91.175] (/10.132.91.175) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 Mar 2019 18:05:08 -0700 Subject: Re: [RFC][PATCH 03/16] sched: Wrap rq::lock access From: Subhra Mazumdar To: Julien Desfossez , Peter Zijlstra , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Vineeth Pillai , Nishanth Aravamudan References: <15f3f7e6-5dce-6bbf-30af-7cffbd7bb0c3@oracle.com> <1553203217-11444-1-git-send-email-jdesfossez@digitalocean.com> Message-ID: Date: Tue, 26 Mar 2019 18:02:13 -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: 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=9207 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-1903270005 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/22/19 5:06 PM, Subhra Mazumdar wrote: > > On 3/21/19 2:20 PM, Julien Desfossez wrote: >> On Tue, Mar 19, 2019 at 10:31 PM Subhra Mazumdar >> >> wrote: >>> On 3/18/19 8:41 AM, Julien Desfossez wrote: >>> >> On further investigation, we could see that the contention is mostly >> in the >> way rq locks are taken. With this patchset, we lock the whole core if >> cpu.tag is set for at least one cgroup. Due to this, __schedule() is >> more or >> less serialized for the core and that attributes to the performance loss >> that we are seeing. We also saw that newidle_balance() takes >> considerably >> long time in load_balance() due to the rq spinlock contention. Do you >> think >> it would help if the core-wide locking was only performed when >> absolutely >> needed ? >> > 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. I gathered some data with only 1 DB instance running (which also has 52% slow down). Following are the numbers of pick_next_task() calls and their avg cost for patch 12 and patch 15. The total number of calls seems to be similar but the avg cost (in us) has more than doubled. For both the patches I had put the DB instance into a cpu tagged cgroup.                              patch12 patch15 count pick_next_task         62317898 58925395 avg cost pick_next_task      0.6566323209   1.4223810108