Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp363453imn; Fri, 29 Jul 2022 09:09:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vala363PqO1qngm1FEPpv2eDew4lTv8RDeKsStkZ+RyIVmE10UeE7oIrAJSDe6ghhaJ0W0 X-Received: by 2002:a05:6402:1389:b0:43a:ceea:93fd with SMTP id b9-20020a056402138900b0043aceea93fdmr4283949edv.64.1659110964089; Fri, 29 Jul 2022 09:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659110964; cv=none; d=google.com; s=arc-20160816; b=CQ+g+zyowb30mQ+R+vr3kb21/7JjgL/SV3uBPbpLkn8Nr7DlIKf8lge0hW146UrW0v Naof3qt7sJsPgdherPtNWeB/XluIgFz8fJmhm+z19Cpe04P1EJMwmg7r0qGJ4JpMvYh3 75VwXAmaoOjWQd5BEpKhrAF+hw025RiTmoK5UNOyiUvLSh7d/0nGwzSCnaOHlQyafiGE VWlLTH8og9pIMyhCf2ik27OIY3vu7+sogxKLbV2LrMT+Mx6yH8ZCIi63xuYSsq6XWhGy Zyq6I06/MO2bJvcQ68KpYghkVp4mCcYqkmfx9cjpeL0jjwvsO8KvWMpMMmeaJjQjaud2 7STQ== 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=HWtZgfqryZS10gAM5+N9gAYNVLECjP2Z56KMURvmOKI=; b=n0toxv4wr6Sz5+/rpf8chzD12OPNSgk748Qw6dIclYVh3rmA1imYTRWMDBerhzMwVD /ZiM82LJuK4KaQ5yjC6rSIKRx3KnHvhkOnl+NOUDGeIaNxwxK1Qhk1B0Ju/46nMr9iZX RIwxbSY/H0c0Vz62uB/D9V2otV6WWDvr+cLXzQYaiJc9raYBVTmZwxyfRKsRt552cUYe UpdQC95519ZiLKj+ud4KTWsc6AU2oVjc8aiMFLnV9nABdmFzwYMmQ9uzlfjLnInjroUi /24asefEgFAbDPgXvKIfGeMGKOVbVwR9F7l8L5rVdPRNMgRbvCzhCOZGbos+BsnkCc+h xZzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=euHZ1fQ1; 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 7-20020a508e07000000b0043bee43477csi3786836edw.576.2022.07.29.09.08.57; Fri, 29 Jul 2022 09:09:24 -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=euHZ1fQ1; 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 S237885AbiG2PlA (ORCPT + 99 others); Fri, 29 Jul 2022 11:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237961AbiG2Pkl (ORCPT ); Fri, 29 Jul 2022 11:40:41 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F64287352; Fri, 29 Jul 2022 08:40:39 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id y11so7873591lfs.6; Fri, 29 Jul 2022 08:40:39 -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; bh=HWtZgfqryZS10gAM5+N9gAYNVLECjP2Z56KMURvmOKI=; b=euHZ1fQ1C+8MXJDNliazU66pJCoH1NCOGCtqLTKpdeASnGQkf+sY7yxLBk76yeVYay /EThO69XrLUTKSWN5LObbt4loU99UlWOf3oTDCNgKHDilPUDQoXejUL4JiJrJm6V6yJp QzjADGUrd2TOU0iyaCcbid3iRoNcNt+x4ZCX6hH1WxI2IbXnQQQnC4vpzjwftLaXzoCO Iy078jY1RFkL1j0OMVSzwbE1kjl89SWXdJ0MbXnRXay4hXDi/26q8fM/rUsXws4CXA8k HOjiZlnv1LArYZ+NpPcBvrU18gToZT/7AZJVw+dZikNiusCqqcNTqZPCl1johueID5eT VUaQ== 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; bh=HWtZgfqryZS10gAM5+N9gAYNVLECjP2Z56KMURvmOKI=; b=fZcoxnRL9Ms8cl/XtegxISsT/XnpImTW97gcxJvi227/NevidnN2wucYjv1o7AtimK pIvKQW09qXHDmkclJPh1L7NEN99yVTc43S3YP5kdvnXXOJ+XF8dpoDzD0BXn+uElzUX3 NBFvnUlh9EK88BvzNVKxDKqtjdELrQtrW9SsI2SGoHwXkHr5Mg9ZLWegnOxbcQsWX/Wk csKQx8Ezka8EkLEZL45frpZIFaGH6ZOGagvi9OqufopMVKpOq23gn5gxS6+vri/wNE7U S/OkYbi95y83wJnMNa/Qf2XrBWR7hKc4wGEefp1C7gENRsfy17HbHalMRrRBJbO/7S9L PHSA== X-Gm-Message-State: AJIora+MU5kQyxGGvYJOOeeVqZOTvNoZP9E+iQED0Z79QEdAZif8w++p gLcWsHKMAvA+OSiGkj/x7htyX3qg9y/Ly3I75n8oXaWU X-Received: by 2002:ac2:4f03:0:b0:481:50f7:ac07 with SMTP id k3-20020ac24f03000000b0048150f7ac07mr1348088lfr.422.1659109236965; Fri, 29 Jul 2022 08:40:36 -0700 (PDT) MIME-Version: 1.0 References: <20220726175043.1027731-1-robdclark@gmail.com> <20220726175043.1027731-10-robdclark@gmail.com> <49fe9ecf-b1bd-a21b-8d8c-e4a33e3fa821@collabora.com> In-Reply-To: <49fe9ecf-b1bd-a21b-8d8c-e4a33e3fa821@collabora.com> From: Rob Clark Date: Fri, 29 Jul 2022 08:40:24 -0700 Message-ID: Subject: Re: [PATCH v3 09/15] drm/gem: Add LRU/shrinker helper To: Dmitry Osipenko Cc: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Daniel Vetter , Thomas Zimmermann , Maarten Lankhorst , Maxime Ripard , David Airlie , open list 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 On Fri, Jul 29, 2022 at 8:27 AM Dmitry Osipenko wrote: > > On 7/26/22 20:50, Rob Clark wrote: > > +/** > > + * drm_gem_lru_move_tail_locked - move the object to the tail of the LRU > > + * > > + * If the object is already in this LRU it will be moved to the > > + * tail. Otherwise it will be removed from whichever other LRU > > + * it is in (if any) and moved into this LRU. > > + * > > + * Call with LRU lock held. > > + * > > + * @lru: The LRU to move the object into. > > + * @obj: The GEM object to move into this LRU > > + */ > > +void > > +drm_gem_lru_move_tail_locked(struct drm_gem_lru *lru, struct drm_gem_object *obj) > > +{ > > + lockdep_assert_held_once(lru->lock); > > + > > + if (obj->lru) > > + lru_remove(obj); > > The obj->lru also needs to be locked if lru != obj->lru, isn't it? And > then we should add lockdep_assert_held_once(obj->lru->lock). > It is expected (mentioned in comment on drm_gem_lru::lock) that all lru's are sharing the same lock. Possibly that could be made more obvious? Having per-lru locks wouldn't really work for accessing the single drm_gem_object::lru_node. BR, -R