Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3345826rdb; Tue, 29 Aug 2023 12:21:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElvxekfQu+78wdzH8AIbvAEXO4WsPBQk7Ol6PSJ6P9T8ETFGY7wwrqbUM0jIHkaOhz+iR+ X-Received: by 2002:a05:6a21:33a1:b0:14b:e383:d141 with SMTP id yy33-20020a056a2133a100b0014be383d141mr301081pzb.34.1693336905760; Tue, 29 Aug 2023 12:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693336905; cv=none; d=google.com; s=arc-20160816; b=gQ6Q5Z1/ucgbOcFg2sDUu3Ds6w9M/UJnj0YKXV1ryoX3EnN5VDiG/pgPRRh30yQNBk MA2xtJKyhrcEjpgbBi+X2pVGIZn8QM/rlEvDsN6uOy1So8Y66vMHHNnp9ktsFdqgNMyn Fv0+Bew1Dq2MvnzxaIu9zE9i4sSLYeONxTvK//lQyErBAtwEZ4sxIlt2BxQ0/YluBVUp WhztHNRwcsXsuFY7w+EFDXXAyyxGeMUJplwCO40Zwz8p3GzSRGqWzVXjM97FlsTznHW9 HgB0ZY/ex1Q6q7JSkyHo8nwZlW7v0ZH+lk4cu6siMOa4jRcl4IfPguH/AontxVxDv0jm juzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=6ZkinU+7C+e5uWr40BLH/jCmTMNwMcWW0U8rF/KKEn0=; fh=hbKCg83u5FClfpmGrTbHu5wPO20Blk6qvS6qEY5Pc1E=; b=yUyj4C8RffV5kw3rJ0EnJOJQwheqh9zLYEnJCOVKD92GqqlbOXZiJEfdtnquir4wWB t6x4D4qafMydMZ9n/DLvc0KbOIduZzilpvHjpPgSsKKMWPsTMKvQpl4n0qGEK09mRQlR R7qr7tBXIqOZxSQOT9VkeLpuNVm3C/JsQgoZwJok2Vlqkbymyc2n5m0EgNCrz6cuV8ih z8aVXcd0y+44A5NSXqcI4plBgdDFPGn7xVzqIuKKqF15027RuffBKpdm1EQGIZBD4VRg kOCFSkKC5vibguRaaGGms+UxVwlXuUzpKafh3cC5AfA+NgGV73KXg2v0oodcLvaw97nK XNCg== ARC-Authentication-Results: i=1; mx.google.com; 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 kt16-20020a170903089000b001bf7289d2b2si879189plb.315.2023.08.29.12.21.28; Tue, 29 Aug 2023 12:21:45 -0700 (PDT) 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; 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 S234328AbjH2Smp (ORCPT + 99 others); Tue, 29 Aug 2023 14:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbjH2SmS (ORCPT ); Tue, 29 Aug 2023 14:42:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12C7719A for ; Tue, 29 Aug 2023 11:42:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C8656250C for ; Tue, 29 Aug 2023 18:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04F2EC433C7; Tue, 29 Aug 2023 18:42:13 +0000 (UTC) Date: Tue, 29 Aug 2023 14:42:12 -0400 From: Steven Rostedt To: Wang You Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [RFC] remove preempt in do_sched_yield Message-ID: <20230829144212.0eedc210@rorschach.local.home> In-Reply-To: <20230823100705.5363-1-wangyoua@uniontech.com> References: <20230823100705.5363-1-wangyoua@uniontech.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS autolearn=no 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 Wed, 23 Aug 2023 18:07:05 +0800 Wang You wrote: > I see do_sched_yield's irq disable cover preempt disable. In this > function, I think preempt op may not work, or it may have some > special effect ? Thanks. Why would it not work? > > Signed-off-by: Wang You > --- > kernel/sched/core.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index a68d1276bab0..b255e54c1d38 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -8487,10 +8487,7 @@ static void do_sched_yield(void) > > schedstat_inc(rq->yld_count); > current->sched_class->yield_task(rq); > - > - preempt_disable(); > rq_unlock_irq(rq, &rf); > - sched_preempt_enable_no_resched(); The point of this is if an interrupt triggers here and NEED_RESCHED is set, then it will call schedule and possibly schedule out the task. When it gets scheduled back in, the first thing it will do is to call schedule again. The above code you deleted removes the spurious schedule. -- Steve > > schedule(); > }