Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4956967imu; Tue, 29 Jan 2019 10:17:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ULIjNMp2z73E5yxHelJBI1aJyvBB9g/dL/Sm/uL8lZGrxgw8JRZkXP/n8K+lz5I+22LzJ X-Received: by 2002:a63:9b11:: with SMTP id r17mr24807038pgd.416.1548785861092; Tue, 29 Jan 2019 10:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548785861; cv=none; d=google.com; s=arc-20160816; b=IyNvUuybS8I6r6BZMPKYDLKhGgGU1AW02WB7oBp22MRqofoAXAoZxlnCd/HTNQPxMY n3bBZU+3cMTN4r6iaSRwtI3E4GjwSlaroYjg7OlXdRBlMNGIjjhjxNkdKSm769KkIWCq Q3vO+x/Vq3ArdxR/VUg0olBaW8tQIRcWxONEWKTOoajibZ97e8sp7vhtPlh+K90BFZfc dAi9leZFRhqJqzRH3K7P7E6QrorD7DUSH0RJc4SesezCOENNYTEP6757RkyGtN4sshuu 1yw9eKdMnbqXP2Jmsv0dpr8mEq3IYiDTYFgb8xEmcM9pHSL056oxfh8ZztLc650vXemv jTUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ApmOKSKwJ34ByPx19EXm+YEtEj3MA8QK8o2g/+hj+FI=; b=ZeqPspo3K+JSesajVCuWOlws0LQS8uHUxKsXPeOgduziUaTLesaJS9maLES6nhAFjR 82MbUR6LkE/u+PM174KxNbmaVGti1hUiRquRBbWya/EzDXPcVmLBXkN+o9arTw85S5Ga aBXSLoW+wuai934+PFAYNvCj1XHtCQk5WvHo0YR5AzDXzQQ/JLFoPzpOADM/Cf1RKiOJ loNnHN0D+O9smlR+dfxiqYGVSO1dLRWP8HhmaDV6dw/nNhQ8OlO4I8FZAWktLhkSU8Rp HffJNkHHErHatYhozHqnchNboiTk8cGZ0ijA8Cf5uWBYaDlDNWqD+Xk5flGV5xXim8qM TYog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=sZf7AhBz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si2910999pgl.30.2019.01.29.10.17.24; Tue, 29 Jan 2019 10:17:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=sZf7AhBz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727655AbfA2SRU (ORCPT + 99 others); Tue, 29 Jan 2019 13:17:20 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:45670 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbfA2SRT (ORCPT ); Tue, 29 Jan 2019 13:17:19 -0500 Received: by mail-qt1-f195.google.com with SMTP id e5so23254107qtr.12 for ; Tue, 29 Jan 2019 10:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ApmOKSKwJ34ByPx19EXm+YEtEj3MA8QK8o2g/+hj+FI=; b=sZf7AhBz6aFYiMtKB7dZHDPmigJ2H80teY097Ul6nJ0GKxtXNdOoOIzz11LOauzV2P XONUm3CW1F05iHWbR84ZBoLIkukGIyWqtftsMKjzM0uuCM+AkZ5eHValtkoNqm0mp0vb 6/avAGPnX7Xw/3oEqsN710SI3RvyRwzQ2nBKczUUJIt376GlenUsrmHNSuYp1U3UMWlw xLG1UjqpUlrN+qwMss8Xws36ivvk22Wfnc+nerHRpZICWGBCkJdDzyXWyBJzVPzISXYK I/xoBEi559hd3h/1nPFV9qLaJCHBjGYk8BjZJFf7avPfBiWjfM8dbZQal1m4BMNPhGkg XhIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ApmOKSKwJ34ByPx19EXm+YEtEj3MA8QK8o2g/+hj+FI=; b=tjvi0KzJYvZRiW+Lii/e7KoAzYVq16l1UYynxZ6wcu3GksU7gB0T9SzZ7vNmqr7mwB frafHp2gczc/4g5+aeCHO1utts6pBt7mRQgX8BNR+oeCiP0pM6rSqp7JXJD8oFF3Zvx4 TxsvW1CDF40+YZ4IH13+jH++Fi7HA8R2QhiZ/i6STdwbnVN85CtLrDRtgr55N22KISG9 bDNdiDn8Je+Re1q5lLLdH51nFl80KxL2RH9E+PwrrVinyDklPYWYIW1X4qEuJySWuHSz 3C/suQjimroIPEdRT/bLPWydAG5aQt4A91hDiIzn/R+NoAm6uTV9PHFOPjh/T6b9sd9L SxfQ== X-Gm-Message-State: AJcUukeRZFhw8HcOEUkKl/lbjxzWUm37lQsIuq4epkZ61htmtLSGko0i WI3AvHXiPHN2BFM/+Huf5TZpjw== X-Received: by 2002:a0c:a545:: with SMTP id y63mr25234040qvy.119.1548785838791; Tue, 29 Jan 2019 10:17:18 -0800 (PST) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id a3sm93479632qta.21.2019.01.29.10.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 10:17:18 -0800 (PST) Date: Tue, 29 Jan 2019 13:17:17 -0500 From: Josef Bacik To: Dennis Zhou Cc: David Sterba , Josef Bacik , Chris Mason , Omar Sandoval , Nick Terrell , kernel-team@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces Message-ID: <20190129181716.hstuxkdzai4qiist@MacBook-Pro-91.local> References: <20190128212437.11597-1-dennis@kernel.org> <20190128212437.11597-8-dennis@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128212437.11597-8-dennis@kernel.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 04:24:33PM -0500, Dennis Zhou wrote: > The previous patch added generic helpers for get_workspace() and > put_workspace(). Now, we can migrate ownership of the workspace_manager > to be in the compression type code as the compression code itself > doesn't care beyond being able to get a workspace. The init/cleanup > and get/put methods are abstracted so each compression algorithm can > decide how they want to manage their workspaces. > > Signed-off-by: Dennis Zhou We're doing this to have special handling for extra workspaces to be free'd at some point in the future if they are unused. This is fine by me, but why not just add a shrinker and let it be handled by memory pressure? Then we avoid all this abstraction and allow for ztsd to have its shrinker for its extra workspaces. You can even use the list_lru stuff to make it super simple, then you don't have to worry about all the infrastructure. Thanks, Josef