Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1053800rwb; Wed, 9 Nov 2022 12:06:36 -0800 (PST) X-Google-Smtp-Source: AMsMyM4vUPhxrKPSbDcXD87NrfcTRSexRiWDGkbO9ujQG/Dtflp1ZbTFNEGcgCfsfyO4a/qb1JCJ X-Received: by 2002:a17:90b:24f:b0:216:7247:4b9a with SMTP id fz15-20020a17090b024f00b0021672474b9amr34188062pjb.163.1668024396488; Wed, 09 Nov 2022 12:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668024396; cv=none; d=google.com; s=arc-20160816; b=bHc7mFJVjK04GQqjXWCApMzyA60XIenmOA/wRfG0kL+1ysWoURoAGQy1pbQKutslbb N94+fUrgoMyw0St8FPGrppl03RA5RUGh5LxvDxvirBZO0rOuisojG2A8/du6n3O84zNn ml0oQzozRWX4jSVMUdxkuSd9jmLVB0slu/oOMy1CgWiV6nVz+LtfncxTs206sZRiEH+Q xwRvl3jO3TpOacP2sM5PXImBcyCCFEPEsG/hUT7vgQltGH0neuzEhIxUsATGAv2W8wSE YMgfpCHxUmkCRx8IvIMB7kPGH50lqspl5/6QWAyMnlj0E/KOeiiR4RyBAs9nKtK0rnEy bwQg== 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=9+H+e5GyzykBtjKoDgWWzSKIWzCLidVPVGRN0+Jfe8s=; b=jg53eW0xbk0TVhKi60z3tCL9lBknj1CrY/husvFpthmbS2Jj/Sgd1EER55zv7vdZTX EpLwncOhazJDRri6v+LJ+Q8533FR5P85LykmFhfMCTnXNUoANZi5UDB9SRsLQiIXH1hE cS9JqQ5uEF7vZqopLabuymDYejWncm/ltAsAk9DRth+8K006c/O1M4EANKBJsiMQjaJ5 IdMCB/cjp4GK/kUkjBvea7jEVBTk8EVwS7O7ueilro5qAkEPlj/pd26RQQ0kpAcMC/lJ HoSGu0qqAZm2uk8qaC4PtBs/JUV28oyc817Hbq0n9jcaDiiillnb3n2YTIgeLSKOzUth 2StA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=V4kTlhmp; 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=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp13-20020a17090b4a8d00b001fde53d5d79si2556651pjb.5.2022.11.09.12.06.23; Wed, 09 Nov 2022 12:06:36 -0800 (PST) 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=@collabora.com header.s=mail header.b=V4kTlhmp; 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=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbiKISsX (ORCPT + 92 others); Wed, 9 Nov 2022 13:48:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbiKISsU (ORCPT ); Wed, 9 Nov 2022 13:48:20 -0500 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 B6B20C74 for ; Wed, 9 Nov 2022 10:48:18 -0800 (PST) Received: from [192.168.2.122] (unknown [109.252.117.140]) (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 1AF8466029C3; Wed, 9 Nov 2022 18:48:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1668019696; bh=HqPD8JhaCO33vjM9HvhqQQe5npl+/oagnjrYCxOv+Gk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=V4kTlhmprYtAsRaQqn2mut/x7XOwso0ST7pEO3IVukE80DAxz97xRbcIqaw32lfYm pKsxTgNMEqWa1/MmE73at60ZgBfPXBQxDF5ewdIYjByS7M/kjyEol+8DhvTPDnv9J+ c19NbtnDMpLmJTeRHsiUD1mf2t4QbHaIg8DbDyQzzaWGWRAlHMkrwIxDbAY8UvzUmF QQXmfS73Qa7PqtfJxaKgMw3U1d39EseOGrMDjfgf+Ne2QPket1mX5qNlVgW7gBZDGq TqzmJxRHibw/HQLZFtdhemvBfZQHZNRF9mNe17lydZ5sK6QdDC5PKzKBxUxbclVWMq I0tk0zLRSkqog== Message-ID: Date: Wed, 9 Nov 2022 21:48:11 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v8 4/7] drm/shmem-helper: Add memory shrinker Content-Language: en-US To: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Osipenko , kernel@collabora.com, virtualization@lists.linux-foundation.org, Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Rob Clark , Sumit Semwal , =?UTF-8?Q?Christian_K=c3=b6nig?= , Qiang Yu , Steven Price , Alyssa Rosenzweig , Rob Herring , Sean Paul , Dmitry Baryshkov , Abhinav Kumar References: <20221105232719.302619-1-dmitry.osipenko@collabora.com> <20221105232719.302619-5-dmitry.osipenko@collabora.com> <077ad468-335e-c3cd-2f18-557d3ecc3bf4@suse.de> From: Dmitry Osipenko In-Reply-To: <077ad468-335e-c3cd-2f18-557d3ecc3bf4@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 Hello Thomas, On 11/9/22 13:28, Thomas Zimmermann wrote: >> +int drm_gem_shmem_set_evictable(struct drm_gem_shmem_object *shmem) >> +{ >> +    dma_resv_lock(shmem->base.resv, NULL); >> + >> +    if (shmem->madv < 0) { >> +        dma_resv_unlock(shmem->base.resv); >> +        return -ENOMEM; > > ENOMEM is not right here. It's for failed memory allocation. ENODEV > seems more appropriate. Had the same thought about ENOMEM and at one point was considering ENOENT, but in the end decided it's not much better than ENOMEM. > But why do we need an error here anyway? Why not just fail transparently? I added the error handling everywhere for consistency. Perhaps indeed will be better to fail transparently for now since nobody cares about such errors and likely won't in the future. The rest of the comments are also good to me, will start preparing the v9. Thank you for the review! -- Best regards, Dmitry