Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2116631iof; Tue, 7 Jun 2022 20:17:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1I3kh8suYkY79EO5GXAeJyogiZylIb7Fhm0HQQToVoPlu/vwbnXikAmTEzGhBlEChh16+ X-Received: by 2002:a65:644b:0:b0:3fd:d5d5:8c7e with SMTP id s11-20020a65644b000000b003fdd5d58c7emr10132397pgv.590.1654658239015; Tue, 07 Jun 2022 20:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654658239; cv=none; d=google.com; s=arc-20160816; b=pQvr/pYaxedbq6r2ifyuH2gJhTdvPtCzEXq4nV4VxTOPwDzYlPajN1Rl9ifn8VULvJ RYMJPN6MSVlrUOPyMSvt257oxrDbcjbwN73GEqTb/zxBoXtN/O6HMIv8UbHu6kgPScEh W7PMa6qWg/q1bzMUzoMgoI9QtzDTi+qi+G0gWgmD2FXXtAqdgNi6zOgdCU1UqkGdOHR/ T3M97jAq7Uu6Cm3lvokz2rTrEfKQGO9sVuiKBVtMXTZHxvY7HRAP94vg7oOsADJKomxX ZUMIPcElqRWuYtNJvCms6RfPIlKDy9RNt3u72XciPI6UeN+pDqWy9D7cSflio2c+emgh Meiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lUDKINNmSNKJyA5Z74TpYLNCyFsXeWWJAkIHQe7i+7E=; b=yBuA+gD7E1V+TinLg9Ay9iJPRQiLQV45CWSzudNopBrRF9K8/it8ORHDdFmXQ6LthI U3fOmZB442M+6BpYFvEecufr7MRwq46ea3QWKKlJN8VPvit2DzeMIcJAFCeAL1K/xMrI iVfmg3pZcgTBBWVV8o5DdB7H4iRGnuN7vyZjyXab2IR+AdO8RapmdN/2Ns0S+qnaR0Zh dkqEk2Va4yqqgSAFFgoFlUaBMlAVVbl7H0qtVhfWHW7tBZY3olJ15YQ0xQTKmGy68q7w +xfwuIZTKjhc+fPQ2yduP09cMfg+Kh/uhnTDVijKxyUVJqQArUVONtA3kc8D08Sv2EAy nSuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aEIUXUrg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f190-20020a636ac7000000b003fcb19cf926si27530707pgc.48.2022.06.07.20.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:17:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aEIUXUrg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 35FE73E8E4B; Tue, 7 Jun 2022 19:27:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344221AbiFGPeM (ORCPT + 99 others); Tue, 7 Jun 2022 11:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344150AbiFGPeD (ORCPT ); Tue, 7 Jun 2022 11:34:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A135C038E; Tue, 7 Jun 2022 08:34:02 -0700 (PDT) Received: from [192.168.2.145] (109-252-138-163.dynamic.spd-mgts.ru [109.252.138.163]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id D1DF06601A26; Tue, 7 Jun 2022 16:33:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1654616040; bh=1OHF6wl6ehs/wRC7M/8ORoOFTl8MMQfJ9asXXd+gmRE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aEIUXUrg6wlcmhJWW9Dpq0CD51JiB4Gk+im588kYV1D7mO9ub6yKFVwNOXpZVJ2wM opGS/8b5tqT6A+Qs0IOWZkFwx79fas7g7J+6UFuPd62KDBH4Udp9hStEJ+Rda/cqwS /URMw8PUaP1oUBVHs2Yv4T39A3FIsYQBzAsp8bo0QFJ3mZ0J+ykNSYh0VcCXFnvq3G IOXQEb+tEfv6oiz2y9m8bvih3N0zkAqVp0jlIZFmtAilcr0aTfPA8jEpZx7IeH9ey7 VUWWcHduvM3mB3xQmqfjKAk9sBAsGQj/TYmOnhe4+/BKszV79pAEu3Vi5r8hO/X1HA L4he4Zd+PxFGA== Message-ID: <382d50a2-8e47-5e0f-726b-f077be5b8bc6@collabora.com> Date: Tue, 7 Jun 2022 18:33:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker Content-Language: en-US To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Daniel Vetter Cc: David Airlie , Joonas Lahtinen , dri-devel@lists.freedesktop.org, Gurchetan Singh , Thierry Reding , Gerd Hoffmann , Dmitry Osipenko , kernel@collabora.com, Sumit Semwal , Marek Szyprowski , Rob Herring , Daniel Stone , Steven Price , Gustavo Padovan , Alyssa Rosenzweig , virtualization@lists.linux-foundation.org, Chia-I Wu , linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , linaro-mm-sig@lists.linaro.org, Jani Nikula , Rodrigo Vivi , linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Tvrtko Ursulin , Daniel Almeida , amd-gfx@lists.freedesktop.org, Tomeu Vizoso , Gert Wollny , "Pan, Xinhui" , Emil Velikov , linux-kernel@vger.kernel.org, Tomasz Figa , Rob Clark , Qiang Yu , Thomas Zimmermann , Alex Deucher , Robin Murphy , =?UTF-8?Q?Christian_K=c3=b6nig?= References: <20220526235040.678984-1-dmitry.osipenko@collabora.com> <20220526235040.678984-18-dmitry.osipenko@collabora.com> <2aedbd68-cb4b-157c-1ddb-dbdb9348d2fe@gmail.com> From: Dmitry Osipenko In-Reply-To: <2aedbd68-cb4b-157c-1ddb-dbdb9348d2fe@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 6/6/22 13:57, Christian König wrote: > Am 05.06.22 um 18:47 schrieb Daniel Vetter: >> On Fri, 27 May 2022 at 01:55, Dmitry Osipenko >> wrote: >>> Introduce a common DRM SHMEM shrinker framework that allows to reduce >>> code duplication among DRM drivers by replacing theirs custom shrinker >>> implementations with the generic shrinker. >>> >>> In order to start using DRM SHMEM shrinker drivers should: >>> >>> 1. Implement new evict() shmem object callback. >>> 2. Register shrinker using drm_gem_shmem_shrinker_register(drm_device). >>> 3. Use drm_gem_shmem_set_purgeable(shmem) and alike API functions to >>>     activate shrinking of shmem GEMs. >>> >>> This patch is based on a ideas borrowed from Rob's Clark MSM shrinker, >>> Thomas' Zimmermann variant of SHMEM shrinker and Intel's i915 shrinker. >>> >>> Signed-off-by: Daniel Almeida >>> Signed-off-by: Dmitry Osipenko >> So I guess I get a price for being blind since forever, because this >> thing existed since at least 2013. I just stumbled over >> llist_lru.[hc], a purpose built list helper for shrinkers. I think we >> should try to adopt that so that our gpu shrinkers look more like >> shrinkers for everything else. > > What the heck are you talking about? > > I can't find any llist_lru.[hc] in the linux kernel sources. I think Daniel meant this: https://elixir.bootlin.com/linux/v5.19-rc1/source/include/linux/list_lru.h https://elixir.bootlin.com/linux/v5.19-rc1/source/mm/list_lru.c -- Best regards, Dmitry