Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp270689rdb; Mon, 29 Jan 2024 01:27:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IG88NSAfsWPTHElAhaiiSYKXWFDlseCPTpX7pl4PZjxaeklWO48lZ/xRwyuaSprh2Euj/Ev X-Received: by 2002:a81:84ca:0:b0:5ff:6487:1b7f with SMTP id u193-20020a8184ca000000b005ff64871b7fmr3768122ywf.99.1706520424133; Mon, 29 Jan 2024 01:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706520424; cv=pass; d=google.com; s=arc-20160816; b=yS9SCm4YiF6zp3SSCC4YTaww54HPMKVuq3e60h49jAq6Qyxj1TgB2ttkdHtggEvsrA ioLX4iB4RJ2iR6fE8gdfKCsLjDPEOJYoBMrUyo/PAqtill/qs+a5lmOxB9xNv5Qw9KwQ S9Jg0KasjgtGys53roDm1twsfSPR6vd5v9JKDjj3WAwMCEABGg7SNYZQySlod3FabPr5 TZHv9BeYVN2o1rpHes28i6J71zzhu6NXY+NZPMj6bjgCJvBxXfg6zuErcY6dLlKrv7PX 173vWVxlGVmsBylOwXu9RyNpYBLlpNRcyFNLGqdHpUsGMhUld91FV3Me8a4d1S0DGBHt wD0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=FtiYhQJcL/tgcQWzxWVkFK+L6Yf2ZalKgre2nltCU3s=; fh=zv3b7agrNaeEFRhY4GDwVw5suxM+XDJg1xiQ9xbDO0E=; b=l/2/ysKj+hDf5P3aq9SkCwrUWLM8RZ2PNRvjSjYf9/WzIBdSNYcP9M8TeSrPZCyWOM cRdm+sVcZYPw4/TKnQicBm4jG9HctEKYTS471dvPhoVUNVMcPRLibU0Q+ok2FnT6FHn+ I1ELpEw+XgXlWcrtZbXdYnUvpxGS2Z/M527dXugavfacWREgNA/rGLP1guH+q+AlZF9k V5tT8evO3eqBw5skBH8kW0+GZVZeFLK7KqlL2j561G4Js35bAYfQpjpGR9jWHYxHzxzx EJwCBNzQ9t5KMYeQ8kDgM9cEqOc4ZkWAm77BemvrRD+0KIh14lKx4CD6A2RI+8K2Pgpy BVMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=3dWWHEru; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-42444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f15-20020a65628f000000b005d8b6a84416si3522307pgv.534.2024.01.29.01.27.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 01:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=3dWWHEru; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-42444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C13B5283512 for ; Mon, 29 Jan 2024 09:27:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85BE855E74; Mon, 29 Jan 2024 09:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="3dWWHEru" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09C0455E59 for ; Mon, 29 Jan 2024 09:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706520333; cv=none; b=d56/yPv/wW0QxaLgd8oRsjsWOChUcoAY0LgdqbK1CMy+eI60Xh1MYUJwIKb8Q24F8OBnn82BmySlJKm8b3CzOtbYAnlDeoH3pRl+ScYFXEf294PLf0IMOCS1lYCEySl7hnuNecRb2gwxCaHshpME3LfzO2NElbYM2qTaPwrkJx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706520333; c=relaxed/simple; bh=ZeASRK9OQU0zk9iDytgg8kPkaNP8KWri+NPgrypJ/KY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MnQBtUIn6hCKP8Ud5hqPMiPCpSGLtSQbR92KzHZR4HLGbeEvIuraidsg4jMtI7afjNmk+krMicJbpPRNCMROEmFOO66lqD+ny9hWBJ61E5Nlg+DAAdP6RlE49b4zozM65PoHll8ONONryrUdEyNa7ACKtoDF7eme0LlQONIT4vc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=3dWWHEru; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706520330; bh=ZeASRK9OQU0zk9iDytgg8kPkaNP8KWri+NPgrypJ/KY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=3dWWHEruMWT62ux6ztq3I+1FA3TnZsmeUjbKb2HiRI0njatR9x1yAbwn/KxQWFt7k /AeGxYmbZrVqoJiIe1vjWJsqLE/JlGMVOFYf/OSHvPss28vYYzXZnZolLhO9FvOcMB KBXvUakaOBVZrsKRDNOwnEdLuparFW0i/sY/VunFzjieWBUS2yYeCo+uJRDH+wDi1l FiK5M/UfeAPPF9xxbZSbdLfzq8Lh8PcePRQzUA52HHrpyxOGlmj/0eB09+0IDod8tl bY0hZJ11+DMmefPVR1vuuh/iBfz6iFtvkUrGDUx2u8gdJBrYl+e8dK9zK2upo24F+P yUJ5U4Oll2QOA== Received: from [100.109.49.129] (cola.collaboradmins.com [195.201.22.229]) (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 madrid.collaboradmins.com (Postfix) with ESMTPSA id C647F37814B0; Mon, 29 Jan 2024 09:25:28 +0000 (UTC) Message-ID: Date: Mon, 29 Jan 2024 12:25:26 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v19 22/30] drm/shmem-helper: Add common memory shrinker Content-Language: en-US To: Boris Brezillon Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?UTF-8?Q?Christian_K=C3=B6nig?= , Qiang Yu , Steven Price , Emma Anholt , Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> <20240105184624.508603-23-dmitry.osipenko@collabora.com> <20240129100112.35c73f18@collabora.com> From: Dmitry Osipenko In-Reply-To: <20240129100112.35c73f18@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/29/24 12:01, Boris Brezillon wrote: > On Fri, 5 Jan 2024 21:46:16 +0300 > Dmitry Osipenko wrote: > >> +/** >> + * drm_gem_shmem_swapin_locked() - Moves shmem GEM back to memory and enables >> + * hardware access to the memory. >> + * @shmem: shmem GEM object >> + * >> + * This function moves shmem GEM back to memory if it was previously evicted >> + * by the memory shrinker. The GEM is ready to use on success. >> + * >> + * Returns: >> + * 0 on success or a negative error code on failure. >> + */ >> +int drm_gem_shmem_swapin_locked(struct drm_gem_shmem_object *shmem) >> +{ >> + int err; >> + >> + dma_resv_assert_held(shmem->base.resv); >> + >> + if (!shmem->evicted) >> + return 0; > > Shouldn't we have a drm_gem_shmem_shrinker_update_lru_locked() even if > the object wasn't evicted, such that idle->busy transition moves the BO > to the list tail? Seems so, good catch. I'll double-check and remove it in the next version. -- Best regards, Dmitry