From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C16C7618E for ; Sat, 22 Apr 2023 10:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjDVKmX (ORCPT ); Sat, 22 Apr 2023 06:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjDVKmV (ORCPT ); Sat, 22 Apr 2023 06:42:21 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 035FC171C for ; Sat, 22 Apr 2023 03:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=nTBRzrCFMJSyQV3xF+3c2r7V805pGMBvCif9qSRYP6U=; b=I/OmNk/6ia8kuizDRcqmISarq/ VI0CPyYAQ7iK6sj2K5lj7lMZFE5+Pg/gGC1/l89ozHCejHiF8CuqzyDCOfrI9In/SGG5sJIyF3ssn oWsir7QQ4RERRTuEt0jH5N5TTyi7fi+mz0RcGrdWD3Rhc7vij+gl2Wxy1pGM5r9REXZU9fgO0Cnqd pqSb4b5Tyd4fvSy50oNu5eXVvS3sTtjTAst/qJpmSOA3ToWhNz6KHxJ+2DDptnRAq1ooifILq469S Epkp6h5eD1AU74CyqFeoPrvdM668A0Hrpb3L/Vdul6/owy87NG8MJVpO/H/9MfYJNJkflaJuLpPY0 D7UyHKtQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pqAgv-006D2A-36; Sat, 22 Apr 2023 10:42:06 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6F62D3000DC; Sat, 22 Apr 2023 12:42:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2CA2E206D2924; Sat, 22 Apr 2023 12:42:05 +0200 (CEST) Date: Sat, 22 Apr 2023 12:42:05 +0200 From: Peter Zijlstra To: John Stultz Cc: LKML , Joel Fernandes , Qais Yousef , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Subject: Re: [PATCH v3 08/14] sched: Replace rq->curr access w/ rq_curr(rq) Message-ID: <20230422104205.GF1214746@hirez.programming.kicks-ass.net> References: <20230411042511.1606592-1-jstultz@google.com> <20230411042511.1606592-9-jstultz@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230411042511.1606592-9-jstultz@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 11, 2023 at 04:25:05AM +0000, John Stultz wrote: > +static inline struct task_struct *rq_curr(struct rq *rq) > +{ > + return rq->curr_exec; > +} > + > +static inline struct task_struct *rq_curr_rcu(struct rq *rq) > +{ > + return rcu_dereference(rq->curr_exec); > +} > + > +static inline struct task_struct *rq_curr_once(struct rq *rq) > +{ > + return READ_ONCE(rq->curr_exec); > +} > + > +static inline void rq_set_curr(struct rq *rq, struct task_struct *task) > +{ > + rcu_assign_pointer(rq->curr_exec, task); > +} > + > +/* > + * XXX jstultz: seems like rcu_assign_pointer above would also > + * work for this, but trying to match usage. > + */ > +static inline void rq_set_curr_rcu_init(struct rq *rq, struct task_struct *task) > +{ > + RCU_INIT_POINTER(rq->curr_exec, task); > +} > +static inline struct task_struct *rq_selected(struct rq *rq) > +{ > + return rq->curr_sched; > +} > + > +static inline struct task_struct *rq_selected_rcu(struct rq *rq) > +{ > + return rcu_dereference(rq->curr_sched); > +} > + > +static inline struct task_struct *rq_selected_once(struct rq *rq) > +{ > + return READ_ONCE(rq->curr_sched); > +} > + > +static inline void rq_set_selected(struct rq *rq, struct task_struct *t) > +{ > + rcu_assign_pointer(rq->curr_sched, t); > +} How is any of that helping? That's just making it harder to read. Can we please just keep it rq->curr and rq->proxy and stop this wrapper fettish.