Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2559035ybv; Fri, 14 Feb 2020 22:04:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxAtPYX/66Difqps26kRe74ptU3X9NZUO58cqUMM1KIVL8vbN6iKDI+AVCRcImY1DGjEh/Z X-Received: by 2002:aca:3f54:: with SMTP id m81mr4070742oia.73.1581746665695; Fri, 14 Feb 2020 22:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581746665; cv=none; d=google.com; s=arc-20160816; b=ou2ndG+j3yHyA6d87lqHQwmCSzI3x6K3s79/gjv0amW4X9ivqoPM0qNlP7PlSOuOTX hGRQ9URFWHdCKcUigFvwtka3USjkteeCvDofCKpfQkpimUhbIFXk8k0bPJxHo5rNDccq WUT+YrHtMJFhrXxbhnjgtU22R1T5PgZBNoiV/AjcnhTBalBTOaTqpnRzwLft6ckrvS5a mx7/uz3USZCPn1hnSVF8R3oSTD2XXa7wMZP+jd9naLG95tcNkiIsVK/N5TZP2u0V9z5h D2Kdo4ff/R6C+DsEVS04rcVjF+MwK8a63TOWv0nhRK2LosU2CmW9TQ3809ludWW7ZMvn ywSA== 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=zxzlXnit2pajsH9JXNI/IWXgXkwjfOCbTSesFxmu85I=; b=HltCHLtQFkmXwb2+w5rwtO+uGWmQrdljQl/3KdjNVubmJdRmIeWpv/bpU/mIol+vBz BksqXXcg3b+bwfPq+Wn98eM5ehignRTAnFt5PLEW4plpXKYOWC9Zbw1ZN43uknAdPxnz kT2NlJ3SvxYVU0UhTZyHyR2KmKjD7de429HRCpjvM12dI6Ky0JlmGRqGZyQ93Y/ig7oX XZyQtJ2tOm8vFemAxWidrU5LZVKAXOXZ5me4jx/2b4UP41uZ/I/afhUY0sHi+Cs+qs5q +uhPeCLvRsGlTsFJIJnpZAhiYzUO62rwnotNVQdp/y0ExhMl5850AUCp1PQcb397z7cd x9eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=STFkDA3d; 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 a64si3936877oif.256.2020.02.14.22.03.40; Fri, 14 Feb 2020 22:04:25 -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=@gmail.com header.s=20161025 header.b=STFkDA3d; 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 S1725839AbgBOGBt (ORCPT + 99 others); Sat, 15 Feb 2020 01:01:49 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45849 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725795AbgBOGBt (ORCPT ); Sat, 15 Feb 2020 01:01:49 -0500 Received: by mail-lj1-f195.google.com with SMTP id e18so12999486ljn.12 for ; Fri, 14 Feb 2020 22:01:48 -0800 (PST) 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=zxzlXnit2pajsH9JXNI/IWXgXkwjfOCbTSesFxmu85I=; b=STFkDA3dKtuhGhSK/zrgbO2q+jHym/SSO9PznaC3TlYvin2bI6rFa9LHCOw9JeI8UN AZFCv+EQuc2e8sZzrehpglcxSCt8kOyahRvKxKF4dTR933b6Fhhe9MY6N89h6bHBL0qm Fa0sxOwkMoq4DzRJJpA0Gd9K8yawdg6JFEKS1io2+esEptPTByl6QMRrfP4uf1woGEfA p7ysZukfI6laD1EnxnSUAx4X1/uKGAjvdhzZXnJ4edDy/g9oMOBRABng3O7/4Z6Kl/OT zVbGK8Xa1mggz3gi3C2zYhJzY2IEfw0aNfqw127+/jM/zHVf91PdWIMsuWFHkNdDpaUi OYJw== 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=zxzlXnit2pajsH9JXNI/IWXgXkwjfOCbTSesFxmu85I=; b=gdG9RL97FTBo6qtVWj29coc8OvOK/gY8xvMyEbFRDRnCEBZC4tbzHTJFuwLdIYlOfE c9TefG+ZGHkWW3iqFYQxblQ9xrEfH3SChzLEpNLFpxLEFRdQ2Y2615C44ubLGvxxiR7K UHPBnZRf9FLtIeihVGX3BfcAd2udP++D9qBtM5k+YcVkBCEgPTKx3zH6IDkOO2NhieP6 9n5f22++9YqUFArGYwwoMc3JsxXA3iGmnkbaA1iCGcr/Rp0pUkQkAzcXYGXyaKKzyAte pH4dOm9jem9geFSww4V6WIVyf8rzYRI6zs3mCQLHVQ2RuEQPZcGOI+5+PI18Vw8N4INt xl2Q== X-Gm-Message-State: APjAAAXSwCw6bghaMNdWxlI9pPByDPig8utUG+bxzVvMd7EFFMV77Pgp EBcEbZJWA3QgCxaJeK8LDq9g55D8wPqwn8aaGvE= X-Received: by 2002:a2e:9592:: with SMTP id w18mr4057852ljh.98.1581746507487; Fri, 14 Feb 2020 22:01:47 -0800 (PST) MIME-Version: 1.0 References: <5e3cea14-28d1-bf1e-cabe-fb5b48fdeadc@linux.intel.com> <3c3c56c1-b8dc-652c-535e-74f6dcf45560@linux.intel.com> <20200212230705.GA25315@sinkpad> <29d43466-1e18-6b42-d4d0-20ccde20ff07@linux.intel.com> In-Reply-To: From: Aubrey Li Date: Sat, 15 Feb 2020 14:01:36 +0800 Message-ID: Subject: Re: [RFC PATCH v4 00/19] Core scheduling v4 To: Vineeth Remanan Pillai Cc: Tim Chen , Julien Desfossez , Nishanth Aravamudan , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , Dario Faggioli , =?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 Fri, Feb 14, 2020 at 11:05 PM Vineeth Remanan Pillai wrote: > > Hi Aubrey, > > Thanks for the updated patches. Merged the changes to our testing branch > in preparation for v5. > >> >> I added a helper to check task and cpu cookie match, including the >> entire core idle case. The refined patchset updated at here: >> https://github.com/aubreyli/linux/tree/coresched_v4-v5.5.2 > > > I did not go through all the changes thoroughly, but on a quick glance, > I feel a small change would optimize it a bit. > > + /* > + * A CPU in an idle core is always the best choice for tasks with > + * cookies, and ignore cookie match if core scheduler is not enabled > + * on the CPU. > + */ > + if (idle_core || !sched_core_enabled(rq)) > + return true; > + > + return rq->core->core_cookie == p->core_cookie; > +} > + > > I think check for sched_core_enabled would make sense to be done above the > for loop. Something like this: > > +static inline bool sched_core_cookie_match(struct rq *rq, struct task_struct *p) > +{ > + bool idle_core = true; > + int cpu; > + > + if (!sched_core_enabled(rq)) > + return true; > + > + for_each_cpu(cpu, cpu_smt_mask(cpu_of(rq))) { > + if (!available_idle_cpu(cpu)) { > + idle_core = false; > + break; > + } > + } > + > + /* > + * A CPU in an idle core is always the best choice for tasks with > + * cookies. > + */ > + return idle_core || rq->core->core_cookie == p->core_cookie; > +} > + > > We can avoid the unnecessary check for idle_core is sched_core is disabled. > This would optimize in case of systems with lots of cpus. > > Please let me know! Yes, this makes sense, patch updated at here, I put your name there if you don't mind. https://github.com/aubreyli/linux/tree/coresched_v4-v5.5.2-rc2 Thanks, -Aubrey