Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp181911yba; Wed, 8 May 2019 18:40:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi+ksfNs/oNiDEBBRKEZz1UC7krt9QYbmwmPbWLyVJKTjMJgEIiUKznYYWlkhyX+G0jCt8 X-Received: by 2002:a62:2b43:: with SMTP id r64mr1219978pfr.210.1557366027837; Wed, 08 May 2019 18:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557366027; cv=none; d=google.com; s=arc-20160816; b=JPsIP5b8+iKQCFxOOZZM4xvA70wvSxAhG4JVGAqyqeCVthKSG5D7RdbAA0NkPOOlT/ u+sUGSHiLeFJPbik93VeUhwaI/kmTOYeF84M0dT6WTdhXw438XN6ii0/LqSsZA/MzPXa 1Xl9WSejdVA1wTcicLhJQY2vtz8d+vw55STq7bYchO/emLQ2orGmFSW7Ja4OhbX39UlI /np9U/wAAVqf12labc6DlyTxfr2AXWUZMA0LpXkb/22FwYaLnyhWxKLNb97d75i5LAFx PzKow+e11OHWaPXMfy/PnU2Sam+oxEdtVHw9nnt6mvsMYPWlCyjQOkSnuXNRUedPk66q CRGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hLMQoawtf7zEIInnvJYm+TQ2l/zeMDbM81eV5mgMe5I=; b=YrVpZRY/GPi84eJJvlSeTkp39dWt8c+bKsmKWXvhdPiyUV0wvLlXkQY3TgfxqfNj38 Dz4jSG+7dV48gFFiQGDaFCWBvefVFbMzzGEii7rb8b92gSKsylDYrmD7qsFlmUjFeWoi FBcizkiGLk3O79LBUnxPVEMa7zZpgdd72jeKuKtjcuwToIuZubu2tyg0z+UWHKTvb1B9 aIJCtH9Dmp8qcIXqkpwoVN/wkH7soBodUDj37soNBhTH0fZuVvVOgDmPWIPfEC2YWK2X Gn7M/kPUoeBsFLFuHjMfC8G8NggOlXI+CyKMck5FFDWtSgIPMoic433KZgwFX2R0Ozzk SNiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="X/7+vmEl"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si771465plt.182.2019.05.08.18.40.11; Wed, 08 May 2019 18:40:27 -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=@gmail.com header.s=20161025 header.b="X/7+vmEl"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfEIBjI (ORCPT + 99 others); Wed, 8 May 2019 21:39:08 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:46848 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726503AbfEIBjI (ORCPT ); Wed, 8 May 2019 21:39:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id h21so517933ljk.13 for ; Wed, 08 May 2019 18:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hLMQoawtf7zEIInnvJYm+TQ2l/zeMDbM81eV5mgMe5I=; b=X/7+vmElyjBWNBsb1JgMyNZqvJuMIQvL+Y8Zp0Nz7YQ29HxJTUaJsvfs8RjIIIwH+W xPFnXatt+h0EQ1xtlFzvEm9wndgh1eawjR8RyC0HAmnTd5QwstvGZm+p6QIlgCi+oFFr xNX0tjStcYBDAUM8e71Yl4RhalJaxL06e8B4PfkWzvDgaL8jmLFwzDk9MyVfEkhNNkjG zXh6gb5Kar9u4NX2vQdZgyEXwM9AgyEcl734F+qfpgOCpI6AL3DzS6rJIZEtwt6kQj1k jdIUDVQgzgbtLoVuuYAmKblgfpLowSGzn+CTz3BUq7XbLANw5xybjD7evO23lfFa5Vxc AoqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hLMQoawtf7zEIInnvJYm+TQ2l/zeMDbM81eV5mgMe5I=; b=CepB5MQLE43JCcfQmzgm0kxb5TFBsRT/ttZwd5L9Pb62gO38krJ7cZEwJPjLqr6znu ozHcqAR+E41HEsNI1Fr8U6SCL6UfdWwudZn1fmb9k/Nthmq3q9w1BZomlNbrA6Z548gC FUpT5FSUPBv64EmZxHCQs/5vzLCye1TxqFgBhsL7RhQIwhSV9FW2ySeSLGoj1vSqqGEH ZKCMNH7CVNkuuhe+GKrYiMiBT6prz4AhtX6kSrXO+Wzyh3WzaWpmkvIMGceTozARXW22 sjNTTjqpDNdMJLKlr2ohTjnq37SG8Q7cDZjGP7iJrc7gI44Ls0QjtrhDjFPEu3AlvnvW XSow== X-Gm-Message-State: APjAAAWudMpWb9or/Hvp/Vb6XAzynQIOjTKvWZHsaAoI6MB5piuizCoU j1cYcqP2q/PdBq0cnqoLkwLzZG9d2uDY53C9W+U= X-Received: by 2002:a2e:984d:: with SMTP id e13mr544040ljj.61.1557365946270; Wed, 08 May 2019 18:39:06 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <8098b70b-2095-91ea-d4ad-9181829066c7@oracle.com> From: Aubrey Li Date: Thu, 9 May 2019 09:38:54 +0800 Message-ID: Subject: Re: [RFC PATCH v2 11/17] sched: Basic tracking of matching tasks To: Subhra Mazumdar 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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? Thanks, -Aubrey