Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4042775ybx; Mon, 4 Nov 2019 06:58:44 -0800 (PST) X-Google-Smtp-Source: APXvYqw/a4aU+M7tXzQe9ZSoUo8uROxOEtLdbczvD3tA/3ACjkdg9iTUtXAolCZNlHHUxij+zIn6 X-Received: by 2002:a50:a227:: with SMTP id 36mr29590907edl.262.1572879524011; Mon, 04 Nov 2019 06:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572879524; cv=none; d=google.com; s=arc-20160816; b=SKPJQtXnh4mGztAZEnf8PBFYvzMXkbSehsitxUqBRhzKTEFErfpjdwTNpmTF1A0+Kq cE8bzA1UJGbzMXqfaee/MlYNcizfKc0G2KU8PxdzdX6L29i4hUxGZ4DmaKyqtm5n/3i8 PLF8rKfTod5+OMbqF3PMvX919K4EbtnajXfX9ClFnG/RvplkaJbGVW7ZxcDg0asNajIa THDSP6OtTzZI1kx93R909XgwSqMglwV/xaK++w0IbfTIVBCpZzdVBHQq9WgF+LEh/bA5 KbQPNhEikmGaiUp/w6YtCfFpd5nCiqL1U6t/WJI79UbJi+GV6jv+ebL2J/C4wdYSTpE9 NmXA== 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=kCB1Iq/WOhOO8E7BWFVL1ZTSBqLFoCfJ5l+QYe87RSo=; b=0oEaLbmkVSTJacUOijauNrTxzPSUAlWspNWyBqEXoZXetQpqXh4QJ5oX+INHDIpbk+ WXeTQ2uS588RCAUkANKgoHyMZctPFW2sfnL7xKIq0h/ujLC3jF367hz38rXMqdEybny4 YoP2wlK7idb4LoA+rJ44S2B8IKYtzTC35atoBJokPJItsPDztLRR4qS2NG3o4vsIy2Mh Ov5oHKGrX5WiXZuFE3j7kaDtQvi8TK70igPWkGCDI2bdyogGFQ1HFRrs4Eu0aT4/zRi/ Wzk2umCkBB7K09rS0JXyeKTKTufym4FVNTs5SOUglZSIbNJtDw1ITyZFexqHMXohkOKG LTZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jR5ue4pD; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si8506222edc.238.2019.11.04.06.58.21; Mon, 04 Nov 2019 06:58:44 -0800 (PST) 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=@linaro.org header.s=google header.b=jR5ue4pD; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbfKDOzF (ORCPT + 99 others); Mon, 4 Nov 2019 09:55:05 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37382 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbfKDOzE (ORCPT ); Mon, 4 Nov 2019 09:55:04 -0500 Received: by mail-lj1-f196.google.com with SMTP id v2so17951428lji.4 for ; Mon, 04 Nov 2019 06:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kCB1Iq/WOhOO8E7BWFVL1ZTSBqLFoCfJ5l+QYe87RSo=; b=jR5ue4pDTreBeJb+rxWIZwdLLF777xKgDOUL4dR4Yh46AO+d24A9WJ4TQcGfBUPNWJ zFOFZHijuNpYLRn1VtGwNutUBOyQiamwbj+7Y+x+wuFnKajMqYPnJ8TVPlRBtJMAipP8 904ukGmnfl0H45AaTREkCBuzRqQ5eemHc4P7R/Y/gFzf95RaQ7qIAkkIHsQTE+QeCZNB fWnUvzhiWYQXA3IIIqxLmAgz0gKfsynHoEkED3yOghotQ5660krja5MaANzH+0Ap5n0a BImN1Q76AcXT3L+9QLifWSDFbiOqvcs7M4ebKMyzg2RL8cXs4oEg1t1WiPG4pfXqJ8JY gHQg== 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=kCB1Iq/WOhOO8E7BWFVL1ZTSBqLFoCfJ5l+QYe87RSo=; b=DLk0t+E1kztRmOB0Y6j119q+kVNRI0EO06bCY8U8i7JXs1PvEoRecwqXC9QgTGGbnA hVmCDXh6ffMi5Sw29TH7lQmtigDyZiQ1xBQ+axkXBokMeqwEKKzIJ8xU5Xx/KXvIhIY9 XVI90zm6mg2UvvpCl2ZYM3ZAlRs+dOdZUOAbk1OSIhjec3d4Cs3R7CUzZ+/CaeDMwZKn Iu02Un82HNHKfrqP+I8CVcJSCNe77Y0MCSXeG7NVgw06bxKwOfjofrWTFvor+tR8EVR+ prIx3x5zFs3GxfhhIHji8ksJkPWZCf617G8ein5seiQKS0ASe6tpJFu2Oy7dIG0byssA CsKw== X-Gm-Message-State: APjAAAXh0SIo7IUioqvYNbmGds0eiv3fSQMSIUYsj2qg9j3sn8zguHML fe4LYM2jUGaGC0kT55oU0qA0nDG3X11JSdXqZeHFIghUPXY= X-Received: by 2002:a2e:9a08:: with SMTP id o8mr897412lji.214.1572879302296; Mon, 04 Nov 2019 06:55:02 -0800 (PST) MIME-Version: 1.0 References: <20191031184533.67118-1-joshdon@google.com> In-Reply-To: <20191031184533.67118-1-joshdon@google.com> From: Vincent Guittot Date: Mon, 4 Nov 2019 15:54:50 +0100 Message-ID: Subject: Re: [PATCH] sched/fair: Do not set skip buddy up the sched hierarchy To: Josh Don Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Paul Turner , Mel Gorman , linux-kernel , Venkatesh Pallipadi 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, 31 Oct 2019 at 19:45, Josh Don wrote: > > From: Venkatesh Pallipadi > > Setting skip buddy all the way up the hierarchy does not play well > with intra-cgroup yield. One typical usecase of yield is when a > thread in a cgroup wants to yield CPU to another thread within the > same cgroup. For such a case, setting the skip buddy all the way up > the hierarchy is counter-productive, as that results in CPU being > yielded to a task in some other cgroup. > > So, limit the skip effect only to the task requesting it. > > Signed-off-by: Josh Don > --- > kernel/sched/fair.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 682a754ea3e1..52ab06585d7f 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6647,8 +6647,15 @@ static void set_next_buddy(struct sched_entity *se) > > static void set_skip_buddy(struct sched_entity *se) > { > - for_each_sched_entity(se) > - cfs_rq_of(se)->skip = se; > + /* > + * One typical usecase of yield is when a thread in a cgroup > + * wants to yield CPU to another thread within the same cgroup. > + * For such a case, setting the skip buddy all the way up the > + * hierarchy is counter-productive, as that results in CPU being > + * yielded to a task in some other cgroup. So, only set skip > + * for the task requesting it. > + */ > + cfs_rq_of(se)->skip = se; > } You should also update __clear_buddies_skip to only clear this skip > > /* > -- > 2.23.0.700.g56cf767bdb-goog >