Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp214229yba; Wed, 8 May 2019 19:17:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUcTNhIYtPOsaRPVqx9X0p3RjbhlfUVL+j+Sgc11/HfawlWfGnJ0NLCja7lwJ0j4cuFN08 X-Received: by 2002:a65:60ca:: with SMTP id r10mr2205803pgv.64.1557368245113; Wed, 08 May 2019 19:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557368245; cv=none; d=google.com; s=arc-20160816; b=gYVEqROcciYIw/1wTYSoJfrBweBV03ixjjFMv5kjYHPOI+k+wtGvd4izngP60GVYHM 2vXqHENL5AefQg9e8DIy0H89VKtSUS6G7d4MWjLP7HzhY7NzEoumyKtcJigdaV/BhLfg R/IphCFmodVm6bHa93gCXP9ozBtoxmCcc3AeEMCMfy5kuCLjd6kOx8R0Kt3LzyUQo0r+ IcuGZTpE7YUNssVjw3W7k1XTlz2RxFf26p6uzZLMpjCq7bKGsCxomrSvt6g4GIccpl13 Dk+JszQI/HAxPo1w+25vPL3GbvMy/Nbzz1P2isC5zcgT8TJ6CbMjNQAU3rE9PylgAs+T 5DfQ== 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:from:references:cc:to:subject:dkim-signature; bh=IFDV7oPHgoa3Ih86T8SrYHUlKrBp0rVil4J7SjjEnq8=; b=f9UtkAjypSDaaZ7kNFPmvJ301A3AzIdmT/+89LhMQ8fdvPcBPaRja8OeWoTTtD2oDs ELEGplTHMpl7OpeKsJpb/voPoZAbV5ApC2ZvWN5GhEzVAyT3omjwbQC/Z3h5hyT0f+xg +UyX4QikiD8FzvxPu9q5pAWODN5+ntzXdqsdrrzTZ8/fHJenDZRDQDpIss7sAPfe7tym 1pmAUteEMnFJlQO8dhvpk5i0xdPRJTDBwGE4UgwTrFuv8OOmvYD1CxzXUwKkTUv6Uah5 jLbvLoxk1prC39y8GnVoWo/rN8o1Q+mK2nEU2H/IM6hzWthVbZzYqV+hRfKLSIW0BLCj 2G2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="l1ti1/vq"; 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 p2si1180786pgj.138.2019.05.08.19.17.08; Wed, 08 May 2019 19:17:25 -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="l1ti1/vq"; 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 S1726567AbfEICQJ (ORCPT + 99 others); Wed, 8 May 2019 22:16:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34002 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725842AbfEICQI (ORCPT ); Wed, 8 May 2019 22:16:08 -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 x492926g185076; Thu, 9 May 2019 02:14:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=IFDV7oPHgoa3Ih86T8SrYHUlKrBp0rVil4J7SjjEnq8=; b=l1ti1/vq9RYRfqG4TXh3uEJ9l8V9l2ddSKNVAvSd1VkNDAIGWEMHX8sYG1gb7wKohm0k uVCRnIa3r5bCZsZX7aRBDROCUm5UDFb6/PcPbneGoZ760szAN1EKTFAtqXcjA93Rfbm6 9qrg9yQidCthE0+sI0C1Rybs1Gv9dSqk57qgrHf63ptU7WcH3JtB8g+o0BViu/fuqFki jC7YMn9JynILYGNo0UMeMNl15qrxc5Wln2fAjMazWLUI+YsxxF9JpaiqceRzRj8Q12rt oH7LdXYcWfnsogDRlttgYALuxWj+YWSQB1kAI8d4iHxAWGyZnFKIFmiatZWAScz6CFVV gQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2s94bg7un0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 02:14:23 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x492D6oW153932; Thu, 9 May 2019 02:14:22 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2s9ayfwnsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 02:14:22 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x492EJJw006773; Thu, 9 May 2019 02:14:19 GMT Received: from Subhras-MacBook-Pro.local (/73.252.215.155) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 May 2019 19:14:19 -0700 Subject: Re: [RFC PATCH v2 11/17] sched: Basic tracking of matching tasks To: Aubrey Li Cc: Tim Chen , Aaron Lu , Vineeth Remanan Pillai , Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Kees Cook , Greg Kerr , Phil Auld , Aaron Lu , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini References: <2364f2b65bf50826d881c84d7634b6565dfee527.1556025155.git.vpillai@digitalocean.com> <20190429061516.GA9796@aaronlu> <6dfc392f-e24b-e641-2f7d-f336a90415fa@linux.intel.com> <777b7674-4811-dac4-17df-29bd028d6b26@linux.intel.com> <28fb6854-2772-5d29-087a-6a0cf6afe626@oracle.com> <8098b70b-2095-91ea-d4ad-9181829066c7@oracle.com> From: Subhra Mazumdar Message-ID: <7671d3f0-ca07-7260-a855-473ab58d1c30@oracle.com> Date: Wed, 8 May 2019 19:14:17 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905090011 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251 signatures=668686 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-1905090011 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/8/19 6:38 PM, Aubrey Li wrote: > On Thu, May 9, 2019 at 8:29 AM Subhra Mazumdar > wrote: >> >> On 5/8/19 5:01 PM, Aubrey Li wrote: >>> On Thu, May 9, 2019 at 2:41 AM Subhra Mazumdar >>> wrote: >>>> On 5/8/19 11:19 AM, Subhra Mazumdar wrote: >>>>> On 5/8/19 8:49 AM, Aubrey Li wrote: >>>>>>> Pawan ran an experiment setting up 2 VMs, with one VM doing a >>>>>>> parallel kernel build and one VM doing sysbench, >>>>>>> limiting both VMs to run on 16 cpu threads (8 physical cores), with >>>>>>> 8 vcpu for each VM. >>>>>>> Making the fix did improve kernel build time by 7%. >>>>>> I'm gonna agree with the patch below, but just wonder if the testing >>>>>> result is consistent, >>>>>> as I didn't see any improvement in my testing environment. >>>>>> >>>>>> IIUC, from the code behavior, especially for 2 VMs case(only 2 >>>>>> different cookies), the >>>>>> per-rq rb tree unlikely has nodes with different cookies, that is, all >>>>>> the nodes on this >>>>>> tree should have the same cookie, so: >>>>>> - if the parameter cookie is equal to the rb tree cookie, we meet a >>>>>> match and go the >>>>>> third branch >>>>>> - else, no matter we go left or right, we can't find a match, and >>>>>> we'll return idle thread >>>>>> finally. >>>>>> >>>>>> Please correct me if I was wrong. >>>>>> >>>>>> Thanks, >>>>>> -Aubrey >>>>> This is searching in the per core rb tree (rq->core_tree) which can have >>>>> 2 different cookies. But having said that, even I didn't see any >>>>> improvement with the patch for my DB test case. But logically it is >>>>> correct. >>>>> >>>> Ah, my bad. It is per rq. But still can have 2 different cookies. Not sure >>>> why you think it is unlikely? >>> Yeah, I meant 2 different cookies on the system, but unlikely 2 >>> different cookies >>> on one same rq. >>> >>> If I read the source correctly, for the sched_core_balance path, when try to >>> steal cookie from another CPU, sched_core_find() uses dst's cookie to search >>> if there is a cookie match in src's rq, and sched_core_find() returns idle or >>> matched task, and later put this matched task onto dst's rq (activate_task() in >>> sched_core_find()). At this moment, the nodes on the rq's rb tree should have >>> same cookies. >>> >>> Thanks, >>> -Aubrey >> Yes, but sched_core_find is also called from pick_task to find a local >> matching task. > Can a local searching introduce a different cookies? Where is it from? No. I meant the local search uses the same binary search of sched_core_find so it has to be correct. > >> The enqueue side logic of the scheduler is unchanged with >> core scheduling, > But only the task with cookies is placed onto this rb tree? > >> so it is possible tasks with different cookies are >> enqueued on the same rq. So while searching for a matching task locally >> doing it correctly should matter. > May I know how exactly? select_task_rq_* seems to be unchanged. So the search logic to find a cpu to enqueue when a task becomes runnable is same as before and doesn't do any kind of cookie matching. > > Thanks, > -Aubrey