From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9076047DD74; Wed, 6 May 2026 15:07:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778080025; cv=none; b=CcsD9Rg8oTPIxTGNKj4SVKEPV0ZDXpCRRihvmFtGF3AN2LCRdHFttybxXimjejSENQynzV5YhX85CTjb2XIFJrulZjfU49WH8+L7lE9i9L/bULc/F3z3W5jv++AzL/LN6+GdPhnF19OwoanbSfI0gDSmCYusHjxgvyFq8hZ6H30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778080025; c=relaxed/simple; bh=lBGCayGvLObt4utL3x/Gntz0gbSLpK2Kdmd/cyJzcXs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EHfkEf2LnjDq8scF4+aPanNK/WrfeklCRyVRIV49ZfXMhlJBC96PWugFgDrlRTSSPLaSpPGrqGw+zWNthqhY9i7NbZETj3zgojRoGJMW2VjYKqPbuJF0wX6fB9KVanmnC4A1YyvPzOGGyr30vJxZSO28afk4ZC7hz2XL97BA3yo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=NcQbZM4P; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="NcQbZM4P" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 284A919F6; Wed, 6 May 2026 08:06:57 -0700 (PDT) Received: from [10.57.69.49] (unknown [10.57.69.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A5703F7B4; Wed, 6 May 2026 08:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778080022; bh=lBGCayGvLObt4utL3x/Gntz0gbSLpK2Kdmd/cyJzcXs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=NcQbZM4Pxnep1uNs1Um11J1hVT4lQXEnAMaOkFxE3oksqybNtjvFrceF/FnFfkn9g jh8S5taoT7IRtqSRtBPfp9E+d0EAnUFMSexiz68GGXUka5oKG0UUBLCj/XQiyWb2wF +NbXo5ZBqYWbUaGmo2Hfzo5bVWF1ITcgQzm7dHLc= Message-ID: <829b8887-48de-4cfa-8bb2-79db1471bb8d@arm.com> Date: Wed, 6 May 2026 16:06:56 +0100 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/4] Let userspace explicitly trigger memory reclaims To: Nicolas Frattaroli , Boris Brezillon , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org References: <20260506-panthor-explicit-reclaim-v1-0-44f82ac147ce@collabora.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20260506-panthor-explicit-reclaim-v1-0-44f82ac147ce@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 06/05/2026 11:45, Nicolas Frattaroli wrote: > RAM is not, in fact, cheap. Especially on embedded systems with a low > amount of memory, but known and well-defined userspace, more explicit > resource management can lead to better utilisation patterns. As an > example, a resource manager process on a purpose-built device may wish > to launch, and then explicitly swap out, memory of processes that are > kept "warm", to improve perceived startup latency of individual > full-screen applications without making the kernel figure out the usage > pattern from observation alone in order to swap out the right pages. Have you considered memory control groups (memcg) for this purpose? Imposing a lower limit than currently allocated should trigger reclaim, so 'background' applications could have the limit lowered and then restored when moved to the foreground. > To allow for this explicit control in the context of panthor's GPU > memory, add two new sysfs knobs. The first, mem_reclaim, runs an > explicit priv BO reclaim cycle on the TGID written to it. > > The second, mem_claim, does the opposite: it swaps BOs back into active > memory. How necessary is this mem_claim for performance? Have you done any benchmarking of explicitly claiming vs just allowing it to happen naturally? My gut feeling is that mem_claim should be unnecessary in most situations, but I'm prepared to be proved wrong. I'm not saying this series is necessarily the wrong approach - but I think we need a bit more justification for adding a new API for this. Thanks, Steve > Signed-off-by: Nicolas Frattaroli > --- > Nicolas Frattaroli (4): > drm/panthor: Add freed_sz parameter to reclaim_priv_bos > MAINTAINERS: Add sysfs ABI docs to list of panthor files > drm/panthor: Add explicit memory reclaim sysfs knob > drm/panthor: Add explicit memory claim sysfs knob > > Documentation/ABI/testing/sysfs-driver-panthor-mem | 34 ++++++++ > MAINTAINERS | 1 + > drivers/gpu/drm/panthor/panthor_drv.c | 93 ++++++++++++++++++++++ > drivers/gpu/drm/panthor/panthor_gem.c | 7 +- > drivers/gpu/drm/panthor/panthor_gem.h | 1 + > drivers/gpu/drm/panthor/panthor_mmu.c | 70 +++++++++++++++- > drivers/gpu/drm/panthor/panthor_mmu.h | 4 + > 7 files changed, 205 insertions(+), 5 deletions(-) > --- > base-commit: 2c4b906cd135bbb44855287d0d0eff0ee0b47afe > change-id: 20260506-panthor-explicit-reclaim-3dffed028d8c > > Best regards, > -- > Nicolas Frattaroli >