Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6659359rwb; Mon, 12 Dec 2022 05:01:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jqM8QTajdMqtKz05RZzXbE6uJOXP8TH1mNAQmqDcbPy5whSH7oIsNrars7jTxJhZfGnS7 X-Received: by 2002:a62:ee14:0:b0:566:900d:6073 with SMTP id e20-20020a62ee14000000b00566900d6073mr15141537pfi.24.1670850093324; Mon, 12 Dec 2022 05:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670850093; cv=none; d=google.com; s=arc-20160816; b=NbsZhGpwhHIBMlJlTuYVtukprPgLeIVlQhaLnTepGpNamb/9aZpaeDC/HzJTOlgqQk XPCtvhx+rY49fX5Iw/b4HgPe0FEhi8doVIyZSn1GUXQMTOn5LBUif3qKL98YXe9OGicP JS39X3zHns2wTb+xasCU5qgW3hKd9D9NFmUq6tkOXgBBoIN6Pi3fVlxVvbRYDW+Mr8nn xS4Maf42wUA8A35IHde+pmmZX/VlyG16vuf83XIcrbBcRyACf22pka7qakK7fN5sqSl+ oQn0J3uA7qJ+oDv9DyI0DbU1TTjgAhc/yOKAOEyKNBs9qc9B1FX5ywYSipYITzrWqGdu PSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=f8oYEiclleUA/iIHGMwb4It2oiQV5nIwj7vFi55H19M=; b=S/g4pINGcEzdhN0uMKeO4oiBhw5QZuWpkT6Gh/9uaIc9JyXt8SdUWaBKG1rv54yv19 4EuSDiK5MCQf7j+rxJYgrRHQISybfcnDS4SDjCbMCMIhgTql7DSXkOJ1DbPeOv9pPJ4n h9CH0IMeKG+SfoH+xnFb4WzCzl/Z09qSH3JnCGqY86CilBVI7uTTH5d+4IdctFZfJ9uI Y7Wrrpx0W1GLWB05mwgSoqCRev+2dXdBfIU9fpKUqSUtWcEDKD1L8OUewaPZ1GH74eG/ ikiXkMZnP1KO1lHIW14DvUDiUP2TctrK75as4diBbggPqoGHCzPXJQdAECHCkedouJFv qPkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=aumS+oIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a056a00218a00b00574c8aba4d3si10325286pfi.153.2022.12.12.05.01.18; Mon, 12 Dec 2022 05:01:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=aumS+oIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231876AbiLLMbo (ORCPT + 75 others); Mon, 12 Dec 2022 07:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbiLLMbm (ORCPT ); Mon, 12 Dec 2022 07:31:42 -0500 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 096CFF025; Mon, 12 Dec 2022 04:31:40 -0800 (PST) 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=f8oYEiclleUA/iIHGMwb4It2oiQV5nIwj7vFi55H19M=; b=aumS+oIizYg8zjnzoAAFLwNZUq ZfcBHIZUzxcaTcC2K3dZSYi/Rhd9ACFz+cE/X0etkbUbYN1B4IshMsxgjS0AuiYNPO03UEFUzA7xQ xbRHeQwk8g8DtYB8e73KlLGMOxgZXqA6wMVURMOusNEFrStNGf0bKJU+ZuD8sP9dzkNwqGjZNXzV6 qWrruERj2WuZZ1AHPeWer8FZDRl1f0ecoxF1n7ZOEtqFA6SLR7FQN4nquVs6JNhlEi/WnSG2CKE1B 5amol+vFDUrKUh5dgu45XRCyzl76+e2X2msERF4NGoJ7ZiWnfg0reOQVSl8PLEw+jbwIGbvAi2CY/ bVVxRlkA==; 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.94.2 #2 (Red Hat Linux)) id 1p4hxi-009m7S-BD; Mon, 12 Dec 2022 12:31:15 +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 1AD9B300462; Mon, 12 Dec 2022 13:31:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D221E20248CFF; Mon, 12 Dec 2022 13:31:11 +0100 (CET) Date: Mon, 12 Dec 2022 13:31:11 +0100 From: Peter Zijlstra To: Tejun Heo Cc: torvalds@linux-foundation.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org, joshdon@google.com, brho@google.com, pjt@google.com, derkling@google.com, haoluo@google.com, dvernet@meta.com, dschatzberg@meta.com, dskarlat@cs.cmu.edu, riel@surriel.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 14/31] sched_ext: Implement BPF extensible scheduler class Message-ID: References: <20221130082313.3241517-1-tj@kernel.org> <20221130082313.3241517-15-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221130082313.3241517-15-tj@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2022 at 10:22:56PM -1000, Tejun Heo wrote: > @@ -11242,3 +11268,38 @@ void call_trace_sched_update_nr_running(struct rq *rq, int count) > { > trace_sched_update_nr_running_tp(rq, count); > } > + > +#ifdef CONFIG_SCHED_CLASS_EXT > +void sched_deq_and_put_task(struct task_struct *p, int queue_flags, > + struct sched_enq_and_set_ctx *ctx) > +{ > + struct rq *rq = task_rq(p); > + > + lockdep_assert_rq_held(rq); > + > + *ctx = (struct sched_enq_and_set_ctx){ > + .p = p, > + .queue_flags = queue_flags | DEQUEUE_NOCLOCK, > + .queued = task_on_rq_queued(p), > + .running = task_current(rq, p), > + }; > + > + update_rq_clock(rq); > + if (ctx->queued) > + dequeue_task(rq, p, queue_flags); > + if (ctx->running) > + put_prev_task(rq, p); > +} > + > +void sched_enq_and_set_task(struct sched_enq_and_set_ctx *ctx) > +{ > + struct rq *rq = task_rq(ctx->p); > + > + lockdep_assert_rq_held(rq); > + > + if (ctx->queued) > + enqueue_task(rq, ctx->p, ctx->queue_flags); > + if (ctx->running) > + set_next_task(rq, ctx->p); > +} > +#endif /* CONFIG_SCHED_CLASS_EXT */ So no. Like the whole __setscheduler_prio() thing, this doesn't make sense outside of the core code, policy/class code should never need to do this. Also: https://lkml.kernel.org/r/20220330162228.GH14330@worktop.programming.kicks-ass.net