Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp328729lqb; Tue, 4 Jun 2024 12:38:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ/eTNDAUTl1wElzvmcquH6KNZ8eRX7SeqK5bWavRVls5Jtz3WatSx1p8XmL81+MD5bwkSbyNPqhYrkY8NFu0FQ39+IlTQKc89SeBDlg== X-Google-Smtp-Source: AGHT+IGB6VRD/wh0Gb1/9q0o3oHBPg1uAqE1HBK6kc4NoPwEEwRwy3Bzl4yrJ4hECTRNSWK4Ioq0 X-Received: by 2002:a92:ca0a:0:b0:374:91a6:7bc9 with SMTP id e9e14a558f8ab-374b1f56ba5mr3252065ab.30.1717529923740; Tue, 04 Jun 2024 12:38:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717529923; cv=pass; d=google.com; s=arc-20160816; b=ltrKwk6suOFPOI71afau8eARXPaj5og4GjMkOYcwAoJ1VTRluS+JZzJ+1oyO9UfNm2 uIjezLI2hTvwbGSPUfSN/aZ3c8mc4iFrixaFbeiv0z4MrW81juuroEWFfpVH+nRBfo0x Fr5XH3a6ULIuSszxi4/Pyj6IaL4PRBz3fRtjqBDN+tM/QwYSUVrbLmbWTGp3GVNtcy31 59qepPI86CQGxTB+BD7rIMshltYejXLtJf/fNe1N9sj/r3vAhJEd672cA4Sw1fojmByw 1+sGlrKPyEuc7pJeQEZyKQnR+mpYAswXqLvNl1bmD5DVi4dg2RzYge4EEjjP67i6QQXK egkw== ARC-Message-Signature: i=2; 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=3J17X2p+cnWasKVfDXxTGf9lXe/9qGyWsLMV1FlmzFk=; fh=jtbgQ8vfSNIjIIHfvTpj9iNb4Ry1SjYIWMRxpdHvV9s=; b=M3O9TniU1nfuFTiqoYGAlnNl1eqh7XsyUx9+/LDXedcLqogc3SMWrOZpFGi9+vaxcZ DzEd4+5KqtC7qAEo2zeuI97EnH2/cpdw+Mp4CxhFRrgXnmlCIk4drD2TGbcYR8WPb2Tb oK9vfCB+9xzCdhQQLQKmq5/p5XbK6ynhL+6jmz0n5Ip3XV/acXa0Lf8RqKUYFnxvGElr o8lJyxO1TFCxpmSz1tByiJbkDEAeERX7HCZfEISJTfK7ytoLkmNSfbXr6fn/t/BYpP/t 58KMFq5Nn4oXR9eWXu9tJnNt5qsn3yUNDrN8mIRtTAZakwkuNCXVwb5lGdmSlorbAudp Nl0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rd38HqNX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201294-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d9732f8si8648548a12.850.2024.06.04.12.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 12:38:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rd38HqNX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201294-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 38ECBB2170F for ; Tue, 4 Jun 2024 19:35:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D7BE14B095; Tue, 4 Jun 2024 19:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rd38HqNX" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 8262C14AD38 for ; Tue, 4 Jun 2024 19:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717529698; cv=none; b=Y7bZ04l2ehhatAO9FsBW9EfvrcAwSKdKftmZObXys3R5s3IsfgGTIcQ1yCy9tGcYMZQD0pwwcIF58P2b4TyDFNq8EVQ0Dz5hmNyfvO6vqUOH+fNV7nIYN9uwS92o0raWs6iBKP+3qC8D4IMpEc9BkHP8j6TxH39hkZ4io4bvUB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717529698; c=relaxed/simple; bh=0W6BkEPKkqDB7OjeXyv6kHnRSVj9md0RBv7x9no+QPg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MqB0jFah3SNaJL5QkZ61vV94uLt+ZE5vwtfvjJDQNHa8ISrsh4CDZbBMMEOCOV6donZ7TbVRyhe744lt61Mglqc+e9tPkVYODupHQLnsnBRHzbBOeMPyoTh17KWTR/ojynT5qw62molyVXPqhJYMUJ2G7pW3f5PJmWs6OuWjsCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rd38HqNX; arc=none smtp.client-ip=209.85.128.46 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-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4213a2acc59so20245e9.1 for ; Tue, 04 Jun 2024 12:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717529695; x=1718134495; 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=3J17X2p+cnWasKVfDXxTGf9lXe/9qGyWsLMV1FlmzFk=; b=rd38HqNXA1sWfeszewH7ytx/TYxyDb/urvjDRQTtjCBMXQ6CNoLRVbITOrNmRJNPYL ttlVhwZHXWohq43xKrguHtsrwJxJ8FfUGoOY2jcOVo+sPb0mK0WyMkYGraeBHw/kGSsk eWT34910ii+oyB3ET03cKgAqlYWXnuV6S+LMsxN51uGII7662M4vsGQR1IIrItqc93Zm JXR9gP50fLMGGyRj10RznrLUIc/rJds/xmfF1zjWBzR8drN+kQNYOtZuDgekmEra732y 0rUzyZAzsbQ026B2ZEQWfJXXPmEpMcQdm1gU+7bsFFxcKjb2EXPNsmrq9vF1eFQ7Un8c gfdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717529695; x=1718134495; 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=3J17X2p+cnWasKVfDXxTGf9lXe/9qGyWsLMV1FlmzFk=; b=f+FlbHGSf0PpVLOTcGPyhNiXvpCH0UxAExLi3QxmgxQGLlY/uAnxnIBHkeSgSJV4pQ OOeOGtSPqG1mDdc/tcVRWErYqBczP3Nc8Lo6cMfhqAd8aB/UMlRY6LYK2m0d8YyyBoP0 LrYGwVZmM5OkOW5Y6BYkPpmLcM9bdcGIEGC1rSJjOOEa54JjSVgudf4R3mKxd/mhf96o htI/uRZA4klNCgJVjAPyIWhu4psX6TM6F8Hs4cEf8yUa3JwfUZeOHxz29ygit52GBZQe mfeCVobFhB2WxT6AbHASwcHugczOJBO+PLqWn7WJ/XROnU/EAeOo0jyPnTO3gWKERkwu ZOmw== X-Gm-Message-State: AOJu0YygibmMNGpmpPNNv48OqEEl6YHzkCOM4UNTSw25XOt8nxmVvMN1 tNqy9pvxSsFZOyA0W3A3O3f6lKbpsIuVQCwD7kx2tUMutI2yDIVbgG8+xeOMbs92pZ6vnKDdczk D3Xojeu3kbeghvjpHIVJ12pPrVJ3laoTU6/g= X-Received: by 2002:a1c:7719:0:b0:41b:8715:1158 with SMTP id 5b1f17b1804b1-42157050fd1mr362075e9.6.1717529693994; Tue, 04 Jun 2024 12:34:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240507045450.895430-1-jstultz@google.com> <20240507045450.895430-7-jstultz@google.com> <20240604132910.25pgz3mjrnnwitve@airbuntu> In-Reply-To: <20240604132910.25pgz3mjrnnwitve@airbuntu> From: John Stultz Date: Tue, 4 Jun 2024 12:34:42 -0700 Message-ID: Subject: Re: [PATCH v10 6/7] sched: Split out __schedule() deactivate task logic into a helper To: Qais Yousef Cc: LKML , Joel Fernandes , 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" , Metin Kaya , Xuewen Yan , K Prateek Nayak , Thomas Gleixner , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 4, 2024 at 6:29=E2=80=AFAM Qais Yousef wr= ote: > > On 05/06/24 21:54, John Stultz wrote: > > As we're going to re-use the deactivation logic, > > split it into a helper. > > > > 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 > > Tested-by: K Prateek Nayak > > Tested-by: Metin Kaya > > Reviewed-by: Metin Kaya > > Signed-off-by: John Stultz > > --- > > v6: > > * Define function as static to avoid "no previous prototype" > > warnings as Reported-by: kernel test robot > > v7: > > * Rename state task_state to be more clear, as suggested by > > Metin Kaya > > --- > > kernel/sched/core.c | 72 +++++++++++++++++++++++++++------------------ > > 1 file changed, 43 insertions(+), 29 deletions(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 48f0d4b381d5..8bc5844ebab9 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -6572,6 +6572,48 @@ pick_next_task(struct rq *rq, struct task_struct= *prev, struct rq_flags *rf) > > # define SM_MASK_PREEMPT SM_PREEMPT > > #endif > > > > +/* > > + * Helper function for __schedule() > > + * > > + * If a task does not have signals pending, deactivate it and return t= rue > > + * Otherwise marks the task's __state as RUNNING and returns false > > + */ > > +static bool try_to_deactivate_task(struct rq *rq, struct task_struct *= p, > > + unsigned long task_state) > > +{ > > + if (signal_pending_state(task_state, p)) { > > + WRITE_ONCE(p->__state, TASK_RUNNING); > > We can avoid extra indention for the other (lengthy) leg if we return her= e? > > The return value is ignored for now, I don't mind keeping it but better c= all it > out in the commit message or when you add the new user later you can upda= te the > signature more easily. Ah. Good point on both counts here. I've reworked it to use your suggestions here. > Generally I think patches 4, 5 and 6 could be sent as their own series wi= th > minor commit messages tweaks to make them more independent and I hope Ing= o and > Peter are okay to pick them up as they look a nice clean up in general. > > Anyway: > > Reviewed-by: Qais Yousef Thanks so much for the review! -john