Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8461063rwi; Tue, 25 Oct 2022 07:02:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QPTvBbCvKJfwvGsU7LAKdONX6pk42KyDw9oTYixwM3p3g0uLpzKniGH7FlqJuLWu7BFVt X-Received: by 2002:aa7:cc13:0:b0:453:52dc:1bbf with SMTP id q19-20020aa7cc13000000b0045352dc1bbfmr36371043edt.30.1666706578570; Tue, 25 Oct 2022 07:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666706578; cv=none; d=google.com; s=arc-20160816; b=N5qnv1yIMHUwafuYhmF6nS/46goYeQMTw+Y6sRTDyepODpDPQfGS5tyvWN1JenK7MB WKlJipbzA/O/KLgd/d8TYN/oBAsBix04juG+2JJLptwBUF8zkUC1PtKqzsYmM3OGPkMI WnHuZOKAiCouBppA3oVTA0+Bp+xFaFYhEA+70UykDGTf40YJbq5qBtatMOtjeINsdo8h c4beZyMzlKbDw6H94Exo4uQRnm4mgMEYArZTTxPBEoiSfOPOrPBrW+7MswMUu0OYEXV8 vSZnhvnwW0WHWkvkDkNEfUa1ab4mj4G3yEpTLAo26b1UOZp5QagC6DR3QFCl0dKj3IbV 9kJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=J70jijssEagDP3Vhwq363Yf98xAsG6U4OeAwP38Jv4o=; b=IaQtUPYe7VrAb0axfJ1U4p6lqDM3LCuef+nikEevBL8dOHg/2GSrHUauK4oCkU6gLC qFktQjgxS9FYW5XDLbxa8VFKOAkVGTQnIM9TO56AjE4mkDm09KtadOW+2LupTD2j/2Kq kmXINxEtczUuVJEaSoF8WWvdM9Ph9rJiLJ0YQktDR6CIBSNfUmA5WfELp7m8yZ77u6FF oT7cE6o8BeQTz3M9XfmSy+IvkVDrm5P5lZ861hKdRjPPL7PjDN/HQdyMZ7wwHNHQJRtS aXVRZYkuTxitaL3N0EF8m0+gKhK+gz+z8eap3AMo9211vMZo6jF3T5CT8hYHfN26rYe4 Uv4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GRM2bHAx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a0564021e8c00b0045a22a21abesi3193429edf.299.2022.10.25.07.02.18; Tue, 25 Oct 2022 07:02:58 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GRM2bHAx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232718AbiJYNgC (ORCPT + 99 others); Tue, 25 Oct 2022 09:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbiJYNgA (ORCPT ); Tue, 25 Oct 2022 09:36:00 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1F518A038 for ; Tue, 25 Oct 2022 06:35:59 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id g10so14141986oif.10 for ; Tue, 25 Oct 2022 06:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=J70jijssEagDP3Vhwq363Yf98xAsG6U4OeAwP38Jv4o=; b=GRM2bHAxIoDmgZAsAtSuq7CsCgHocptOR32YNFgMcPiMhssB2d1u14v86pZeQelbru p/o1WBr86IWnAzd2FGcVDB0ko8vewc6pzhNpL1PHDo4aM1qihFpIoolnmL5n8Lu3JYS9 BuG5896I96BPIuCfJB7F8mn2iQOGEWgQYrknk+hKMM5fCFhx/f0IN2UfPWtD40qTCqVb FuGpuE6cuCYHckn2cW82YgU12vZRnUmY1V6bc5/fmUgBmsT5YTKacmnUhmk0Q1u1oboz H4anNk9inuu9P2iDap/jFU8scVl8qnBr48kKMye/QOqoFAzRBaAwsY1BuW4HGQ4Itom0 +jdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=J70jijssEagDP3Vhwq363Yf98xAsG6U4OeAwP38Jv4o=; b=jh6kax+0uIpbxYs76wpW/ZuZVNBdk8ALZls5Cl6819KKx29owzmTFDnZ5jOMdUw+km f3kbX23JrBf17AWNhBgpdYoMBcQm3yBjaKeDsvFX1rirgMXvYPGUGfUe+4U+e/ahavXF J6d2SuoEmbKhJ1w7kgFv5oN+zfmXF8Rmo94iwbl0ZJEF4DboR//AfMgXn7EXBZkIOXE2 fqGqFlkq7AyXGxzMD1SCBIL7+XzDekrciO7URO+fL0UVPfXVM/SOse9XzEGnBDwA53mw t97w/ctRfQYJCeKUrx+6Vq/knvGRnK5OyXcRc3oVsXJ5ksJGFukpV6ySATE/8uDsyqDK qscQ== X-Gm-Message-State: ACrzQf2Bl5sR0t9TH9GfAFXoqC3U+AGUQpwdaN0gs1vF5WP5a0sdb3dV 0VVLSy4zp+nz3L3Ej0MjK+BZ1BTjuYV1gq6vmQjbB9Zi X-Received: by 2002:a05:6808:14d2:b0:354:c733:abd3 with SMTP id f18-20020a05680814d200b00354c733abd3mr19023263oiw.96.1666704959289; Tue, 25 Oct 2022 06:35:59 -0700 (PDT) MIME-Version: 1.0 References: <20221025061846.447975-1-brolerliew@gmail.com> In-Reply-To: <20221025061846.447975-1-brolerliew@gmail.com> From: Alex Deucher Date: Tue, 25 Oct 2022 09:35:48 -0400 Message-ID: Subject: Re: [PATCH] drm/scheduler: set current_entity to next when remove from rq To: brolerliew , "Tuikov, Luben" Cc: Andrey Grodzovsky , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 + Luben On Tue, Oct 25, 2022 at 2:55 AM brolerliew wrote: > > When entity move from one rq to another, current_entity will be set to NULL > if it is the moving entity. This make entities close to rq head got > selected more frequently, especially when doing load balance between > multiple drm_gpu_scheduler. > > Make current_entity to next when removing from rq. > > Signed-off-by: brolerliew > --- > drivers/gpu/drm/scheduler/sched_main.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c > index 2fab218d7082..00b22cc50f08 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -168,10 +168,11 @@ void drm_sched_rq_remove_entity(struct drm_sched_rq *rq, > spin_lock(&rq->lock); > > atomic_dec(rq->sched->score); > - list_del_init(&entity->list); > > if (rq->current_entity == entity) > - rq->current_entity = NULL; > + rq->current_entity = list_next_entry(entity, list); > + > + list_del_init(&entity->list); > > if (drm_sched_policy == DRM_SCHED_POLICY_FIFO) > drm_sched_rq_remove_fifo_locked(entity); > -- > 2.34.1 >