Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp201918lqb; Tue, 4 Jun 2024 08:55:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUx61hJjSbx2e5nPaJbqDRN3T65GMC6ZqRTV5/yOYqgDXi2i+ZeQDAGsOuT+k5rh7S4Payh2ISScrg00wnyYYQHzr9DY/Cn7RE+6qVk0g== X-Google-Smtp-Source: AGHT+IFSszra+lwnnlOifxXlDOlZN/ZwcWre4hRGZ9b1riy5MHZuQJN0jANHc3bmrmxEbxz1Wfhu X-Received: by 2002:a05:6214:4989:b0:6ab:9607:2237 with SMTP id 6a1803df08f44-6aecd5989aemr143210936d6.18.1717516550422; Tue, 04 Jun 2024 08:55:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717516550; cv=pass; d=google.com; s=arc-20160816; b=NyMkrFoA5de7HHRtl0KwGb/v0MCxigsow9uxfB++p1ffVu/wa4jFlPNKP66VWkJ2ml Q0R6v2UnwQ30Eo6qLThjS4261gl9k5yXf6doQk7nizfy/QRXu/qVnrmP2kJwWgkLPnuj qIlUNnfRTOaZm1nF8gji9yACxZRfl0dP9Zz4tlKCPbOTftK0yu7WQVd8Xo3278Po45UK nlzKoiaRrTh5iEQghA8lAMMNzl492RUXIAdK6EJip+o+Uxj9pn3DoiyvBvRXcHl7BQeT b4F6d2nkJObjxK/9JXoGCI3v9uyOqxJXePj6l94dTf8VtZkl3+CxFeGxhQU4MCFtD0vj 0eeA== 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=d+EM2XB1oWAl1p5i4m8GXWwSGr8l1SzFI7kbOydQlUM=; fh=jtbgQ8vfSNIjIIHfvTpj9iNb4Ry1SjYIWMRxpdHvV9s=; b=dmrhE9lk2fa4fl6YRYV9JQ5GDi472LUMMeIU/6EG1Gn+xO02mdE0ZIH2qqfYcFLbki SbjbzLz4yUZWF7ZlIPXbliFEv+gRMia46PRzdlwUfJh6y/eTpnQyn+ERXIBw+eCDJ8Nt Ep31nl0ZWIQ/3J6MzcwVhaMJew1L4jiZS37TuqQPabcGGGQ4qhKTc7wFPk7MkpTPSdc1 D9PtaxGCUGs/2+rK9YZ7xAFxxxnJeF0fuiyg+uXXjEBH51hlQQwWn1pWmhVRKtClBY2O 0vQgeztdbFVPX0jqCG1xuidmJEqFLsrxuxBBofdyr3G/vtRNwAeGEQDMs3apg46TMSK7 S5/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k8Wwitkl; 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-201014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b42b1c9si33108546d6.438.2024.06.04.08.55.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 08:55:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k8Wwitkl; 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-201014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201014-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DFBFD1C24C6B for ; Tue, 4 Jun 2024 15:55:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEAF3148FF7; Tue, 4 Jun 2024 15:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="k8Wwitkl" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 486AC145B09 for ; Tue, 4 Jun 2024 15:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717516419; cv=none; b=Vl0yPDxHVORIbv4wki9Sv54fD4jPA64jpykgiFpIfnP1SZtyFUcwtxc+wlFN86xd0xZRpmmt8kwu8zXc72Y2GlszXZ5gXAWJgJ5okaSdlwxO7ASWUHB36wq/HuN3/MthzxwmsrQsh44Y9kQXZXtdISWJ0+Bz/mPzF7Z2HLUoRmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717516419; c=relaxed/simple; bh=POwko8/7ggSGv+vt4kzMAiiU/n7LYzZiHtKFLPuu0iM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rrhgEOz2fWwOZ/NIpEetRTjvmk+QTXqQ0iK/BGS+KgpAACaDiauD1JYvnPoycj4PT8DyZKYgKsVh0n+/yzrdWUd1rckW5pnDiotv8KrHjLDw/pf16Fp/XF+nQOWlpiPpOC5loaq6FJw3QWj7Rsq0LWw0iWYa4JGTMpxQvaDVqgY= 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=k8Wwitkl; arc=none smtp.client-ip=209.85.128.50 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-f50.google.com with SMTP id 5b1f17b1804b1-4214a7c14c1so116885e9.1 for ; Tue, 04 Jun 2024 08:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717516416; x=1718121216; 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=d+EM2XB1oWAl1p5i4m8GXWwSGr8l1SzFI7kbOydQlUM=; b=k8Wwitkl265NOrNx4vPByl6VHuqMflGO426yL9lLTM8Dy5s0Ot41GO1P+1VPRaA7Zh a9txm6uNB9+JSeXRx/3Y+OgNo8a4j8egwumVmNGpoKa1VJCZw79+xJ83TKmb3TUzB5GO fR2iWeono4qWOJjjxaY89dqwx/iw2Me5zutIrYHUL3SGc9CGO6BEjEWJXFBUJXXunsgZ KZyj+vCbo7g1XcbAn6ISc7/yg5qldA2VRGHJ4ztKZUtmvYZFOdsLn0APEvLMtwt20Y+w DuHPDj0NCbbcZgGUITs7xOSP/dT6MUu2f/V6twQDqTdo2PoLD9yPuXhHgnaqznNXjxG7 IDfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717516416; x=1718121216; 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=d+EM2XB1oWAl1p5i4m8GXWwSGr8l1SzFI7kbOydQlUM=; b=rSaT5jfepVTILe9E01z9IBdBw0jF+bbJHthi75Tdnn1I+w1IoyKbZ/dDW8sm3CPQ28 7hRG4/UQEKmL2K6P2z3RWokLVV459GLveRS1b8KE4ywKD8CIQZlL2gP3+P+alv5Zzq4p vp8x88LHy0zbOA10tvQrSNHzDU6dkYTL6sxVffzN+KJPRDfASFg9RVF+XLmR7mHeOhFs J8rmxqPdUNTjXSE+g7S/rJnSrigGjp2t783DdFK1y2tA0EjSVr/p/TDogQ8oIxzH8CkW 4Qjp0JybGocr8RLtnGhDLOWSfhnjcaIuZIRtoGDp3Fbv34p1/xG7vynhaLZ/oWzRU8qE NaOw== X-Gm-Message-State: AOJu0Yz0aINMn4VKTj+nx/fa2cr4dZZeaecLXO8kl3lPBI1L5xJIa1B5 7WdZBz4fWLKKjiKLJp/FuhB7y+wAjF3/L9C/5DRGl49bVXpZ6X6hp4ufx5Xph2hGiHc9Fgs9Wfm XyM5wL9qhVbAoZDUl3AAbQrlq5XfIH1urXDHsPGYDcb7v1TDlldc= X-Received: by 2002:a05:600c:2107:b0:421:292d:f1e7 with SMTP id 5b1f17b1804b1-4214947af3bmr2887895e9.6.1717516416393; Tue, 04 Jun 2024 08:53:36 -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-5-jstultz@google.com> <20240604131204.n4njtgo4tpo352ht@airbuntu> In-Reply-To: <20240604131204.n4njtgo4tpo352ht@airbuntu> From: John Stultz Date: Tue, 4 Jun 2024 08:53:22 -0700 Message-ID: Subject: Re: [PATCH v10 4/7] sched: Add move_queued_task_locked 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:12=E2=80=AFAM Qais Yousef wr= ote: > On 05/06/24 21:54, John Stultz wrote: > > From: Connor O'Brien > > > > Switch logic that deactivates, sets the task cpu, > > and reactivates a task on a different rq to use a > > helper that will be later extended to push entire > > blocked task chains. > > > > This patch was broken out from a larger chain migration > > patch originally by Connor O'Brien. ... > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > > index ae50f212775e..2d41ebe200c7 100644 > > --- a/kernel/sched/sched.h > > +++ b/kernel/sched/sched.h > > @@ -3480,5 +3480,16 @@ static inline void init_sched_mm_cid(struct task= _struct *t) { } > > > > extern u64 avg_vruntime(struct cfs_rq *cfs_rq); > > extern int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity = *se); > > +#ifdef CONFIG_SMP > > +static inline > > +void move_queued_task_locked(struct rq *rq, struct rq *dst_rq, struct = task_struct *task) > > +{ > > + lockdep_assert_rq_held(rq); > > + lockdep_assert_rq_held(dst_rq); > > + deactivate_task(rq, task, 0); > > + set_task_cpu(task, dst_rq->cpu); > > + activate_task(dst_rq, task, 0); > > +} > > +#endif > > I see this pattern in __migrate_swap_task() and try_steal_cookie(), shoul= d they > be converted to? Ah! Thanks for pointing it out. I'll include that in the next iteration. > Beside this > > Reviewed-by: Qais Yousef Thank you so much for the review and feedback! -john