Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8010702rdb; Thu, 4 Jan 2024 15:44:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2qd1IwR7s1ef25edTu95Xhb1TshLjnnlvcH+VN+yl4ShpdZ5B5gcADT+6JUx/i6JqyvbD X-Received: by 2002:a17:906:4e4f:b0:a27:6fbc:ce5 with SMTP id g15-20020a1709064e4f00b00a276fbc0ce5mr792488ejw.26.1704411871637; Thu, 04 Jan 2024 15:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704411871; cv=none; d=google.com; s=arc-20160816; b=aMYI2UPbjKinfcZpilythpp/jh08HzsixkNMNvgzukKkau7RFXMaFuTLhgwG7nK/FH kcsY65Y8/M/qIhvJjPyPb6pSdIyQc+HxXKvLi0XPF7fLfEBZQGSinHNeMqO+ZcMz3+CV heMBMZHLZTgc70q7Fei6XLT0IDpSOOC923zqkzz374P5cjsKqQ2TnJN25oFcdN7TyNYu gWgm5UGJl+4lhEXwNpfxnPxwpIXsCQyWj4H1/Nh76z3X1dGgqhhTrlCTptlNAXBmjcda +fDoRfvKmUgom3hRIXlAPSwcAGQgNOBbRyU+SrLZaVkzjDrT5SSTDYazxFsfOAXHsKcM xkCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=dtawQTRvweP4ouCym+CPwK0RswtuFa45r31f6ygOtZ4=; fh=BNf93qThzKvcNrUblroeKiFR5/RdNi9rwKlfD7f6Nmg=; b=fZsythfmSjeyG2MvvGLDH4tUpZEgymdWUzrXU6d4LhXKrHjOazW9ItIzC9hjp7bLpn /hj8GnOtqAPq0somcQucprVTcmrSRt9mKh2vIDZlAdTkETjt1AFTYfA7ewCtlcZEM12c swgqhZGm5imd5oAtLLjXnrjW99Z5wtQtg2CnJKFfU7VkWqlmSjg85EOw5DTol8rh2jfX OPBmYT575DN5rRn6oV1P6/kHy9SVpOuHrWz6keoPI3gsVh/MkSX6QiZ8JfWOwxXBWXIH Ae96YEFqz5wWSi7pBq0j1AV+1nG/0PgFTt5rOFqyij4jHC3jP9QxfxPdK4301gQcvZXp JVcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VoA3w1j0; spf=pass (google.com: domain of linux-kernel+bounces-17337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i10-20020a1709061cca00b00a28e4e5914bsi136578ejh.312.2024.01.04.15.44.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 15:44:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VoA3w1j0; spf=pass (google.com: domain of linux-kernel+bounces-17337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 621E81F22F7C for ; Thu, 4 Jan 2024 23:44:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 993D12D60D; Thu, 4 Jan 2024 23:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VoA3w1j0" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CBC32D605 for ; Thu, 4 Jan 2024 23:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-54744e66d27so5571a12.0 for ; Thu, 04 Jan 2024 15:44:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704411859; x=1705016659; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dtawQTRvweP4ouCym+CPwK0RswtuFa45r31f6ygOtZ4=; b=VoA3w1j0/b+OTO+HoNLubsw8tKgjO+HzwRU8FDHxKVtOrj2j+25zgstFiP+OTOirtM Nsawtfw0WCu7DXY+s49aa5FPxoxay1G5+GmvuFw3IJ2b9cbxXwXfCPKgjlWmijFnFkJL QTu2auODJFjFqdzWiv8xeZKrQsXs24/DD4opmn4PSxT3q7jZzW4AJxHagbPNPhXoAsQl VsPokIgl7HfSb55QYhKCMG87XDNPlHjnKvq1bqaLHLM6iMWB8wBiFHdUnH8znW+6mavC somMECW9fdmYXCxfJd6cmu8hoftkP6RIkoD09wytsybreR7z1UBrDYjJtKFlVShtsfSO 2IIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704411859; x=1705016659; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dtawQTRvweP4ouCym+CPwK0RswtuFa45r31f6ygOtZ4=; b=HkQmAOzxTjaH4zAZbF+7j1JfM01oBOk8upLQL5MrBE3gvJtXGR8p9XRc2Wux/+FcwI rsj+xnnIFgqrWaWgsRHTE/M09nc0aph1dFOL3nB7QFlII9YHC2x2SvJ8NcIGcBdZUZR5 73C11/h4FX3A2TaCixiJjkUkLeXRQXae4rf9WeGgqtPxpJQc2h4Hgzfu9suVc3Jv4cIc XSb8/30K5/qtj1g9GyMy7Qdf/7+Wdt7Nvw5weVaTVseziNf1xW9cRNphBy32p+rZ3Khi HNc1aAxJkLQNSCy9hfHgVG5ya4YatOD2s5FhZjkwLwGwqpgwzYhGKpAfbxNIFC8KDrs+ sTlA== X-Gm-Message-State: AOJu0Yz6rIAOa9UO+Nx3XM1nXM/Y3crCb8DGftKXxSVBMX/RMYfK84dq za/Cgh96Tbr6QwMdMqMblwvNhMgACtqmhq/xwk77jHwANFI= X-Received: by 2002:a50:9341:0:b0:557:15d:b784 with SMTP id n1-20020a509341000000b00557015db784mr70347eda.2.1704411859245; Thu, 04 Jan 2024 15:44:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231220001856.3710363-1-jstultz@google.com> <20231220001856.3710363-20-jstultz@google.com> <11171acd-dae7-475f-ab93-a890f0f0d273@arm.com> In-Reply-To: <11171acd-dae7-475f-ab93-a890f0f0d273@arm.com> From: John Stultz Date: Thu, 4 Jan 2024 15:44:05 -0800 Message-ID: Subject: Re: [PATCH v7 19/23] sched: Consolidate pick_*_task to task_is_pushable helper To: Metin Kaya Cc: LKML , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Youssef Esmat , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Xuewen Yan , K Prateek Nayak , Thomas Gleixner , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 22, 2023 at 2:23=E2=80=AFAM Metin Kaya wro= te: > On 20/12/2023 12:18 am, John Stultz wrote: > > From: Connor O'Brien > > > > This patch consolidates rt and deadline pick_*_task functions to > > a task_is_pushable() helper > > > > This patch was broken out from a larger chain migration > > patch originally by Connor O'Brien. > > > > Cc: Joel Fernandes > > Cc: Qais Yousef > > Cc: Ingo Molnar > > Cc: Peter Zijlstra > > Cc: Juri Lelli > > Cc: Vincent Guittot > > Cc: Dietmar Eggemann > > Cc: Valentin Schneider > > Cc: Steven Rostedt > > Cc: Ben Segall > > Cc: Zimuzo Ezeozue > > Cc: Youssef Esmat > > Cc: Mel Gorman > > Cc: Daniel Bristot de Oliveira > > Cc: Will Deacon > > Cc: Waiman Long > > Cc: Boqun Feng > > Cc: "Paul E. McKenney" > > Cc: Metin Kaya > > Cc: Xuewen Yan > > Cc: K Prateek Nayak > > Cc: Thomas Gleixner > > Cc: kernel-team@android.com > > Signed-off-by: Connor O'Brien > > [jstultz: split out from larger chain migration patch, > > renamed helper function] > > Signed-off-by: John Stultz > > --- > > v7: > > * Split from chain migration patch > > * Renamed function > > --- > > kernel/sched/deadline.c | 10 +--------- > > kernel/sched/rt.c | 11 +---------- > > kernel/sched/sched.h | 10 ++++++++++ > > 3 files changed, 12 insertions(+), 19 deletions(-) > > > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > > index def1eb23318b..1f3bc50de678 100644 > > --- a/kernel/sched/deadline.c > > +++ b/kernel/sched/deadline.c > > @@ -2049,14 +2049,6 @@ static void task_fork_dl(struct task_struct *p) > > /* Only try algorithms three times */ > > #define DL_MAX_TRIES 3 > > > > -static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu) > > -{ > > - if (!task_on_cpu(rq, p) && > > - cpumask_test_cpu(cpu, &p->cpus_mask)) > > - return 1; > > - return 0; > > -} > > - > > /* > > * Return the earliest pushable rq's task, which is suitable to be ex= ecuted > > * on the CPU, NULL otherwise: > > @@ -2075,7 +2067,7 @@ static struct task_struct *pick_earliest_pushable= _dl_task(struct rq *rq, int cpu > > if (next_node) { > > p =3D __node_2_pdl(next_node); > > > > - if (pick_dl_task(rq, p, cpu)) > > + if (task_is_pushable(rq, p, cpu) =3D=3D 1) > > Nit: ` =3D=3D 1` part is redundant, IMHO. Indeed at this step is seems silly, but later task_is_pushable() can return one of three states: https://github.com/johnstultz-work/linux-dev/commit/1ebaf1b186f0cae8a4a2670= 8776b347fa47decef#diff-cc1a82129952a910fdc4292448c2a097a2ba538bebefcf3c0638= 1e45639ae73eR3973 I'm not a huge fan of this sort of magic tri-state return value, as it's not very intuitive, so I need to spend some time to see if I can find a better approach. Thanks for pointing this out. -john