Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4071678pxb; Mon, 4 Oct 2021 16:47:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI+WFq2mLThdBoyKdBXA9T8p6N2vzQr/1WMNY5AYwPvRIzIoC5wsdWww2PYO9cSsqkuTXa X-Received: by 2002:a63:2dc7:: with SMTP id t190mr13367552pgt.455.1633391265832; Mon, 04 Oct 2021 16:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633391265; cv=none; d=google.com; s=arc-20160816; b=LEBBfFwonBAjjDTepIXp067HXcQVz+QuS1i+6NAthXClvEpqLBRD2n8tledo4raPbM sCzpcZ3gZwLsojovoN7sZQezcHeWJkJkyBZHfmJzzZXrklLCG/Pwn7vlHkBxXPFXfPCC HQl9ez6exRrrAR3GAPzhIz0cLUf0VuxKxSCKmj2i3/zRmPWD+t6LQTaVjLY+7mX8wDF5 uS1ttVAa+VaE0mQ2yI6fmHV4OHBLVQ/iy8GQytmnkIHyu/kP6jSSu00D/kNrvsAhyqSh JT2O5g4+YXN6LFVT7tu3UsEE72HYln63YvOhSnZmn0tT7AkP1SvpDM0wg4BBwnllnBDx kzkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=kZJWM4F6Z6unu/rs+8fm9uleDQhYGGgncRQjKQf/aDk=; b=S8gXCzbePhpI82NbFmV/hbYFJhHLow63SJWGpPB/ZTNPmsn60JEhi79zY0AIqqKJU8 JY2sSwkxVxjN7TLKNtq22H3i0vFWQhRbpjXQTP8ux/DzHBQR9iMjW/DTc0ldD9ECsbNl 9+4yyTKaPEcfdeFkZDBIHTcJQMGN7xDGfOgl2VWkyOfWGP88e0Q662RVBmKGyKlYnYpF AB66NQarV1XVSy0kVRi79bJ+HcgpHPgDfZowkU/S0o0cMehWq76TucK9erieOogjftxN NXEifJtRFBVy+rVpD/kOh34hMI/4dsf5pUFGwLJ5yzMgsPsUyBw/zaOu+V7lcpTLkMYw 0fdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VWSK07yH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p10si5376838pjm.111.2021.10.04.16.47.33; Mon, 04 Oct 2021 16:47:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VWSK07yH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235684AbhJDU4r (ORCPT + 99 others); Mon, 4 Oct 2021 16:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbhJDU4q (ORCPT ); Mon, 4 Oct 2021 16:56:46 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F69CC061745; Mon, 4 Oct 2021 13:54:57 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id k23-20020a17090a591700b001976d2db364so803199pji.2; Mon, 04 Oct 2021 13:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kZJWM4F6Z6unu/rs+8fm9uleDQhYGGgncRQjKQf/aDk=; b=VWSK07yHbpdJGE2T9j6a20cM1d6NclHBP9VWgpxpQVBKyrqPP+X9QuK0NWKLKwBFZP hIzkqSNpOh88uOkBFgCQh5FDc0tPCOiJZpU7XbluN9peyZ90NjAu+9M6+96g+BGlybbX fHAB8cuFj0j4eOL7GjaQkNtxDiRJ5dghYWoxFhGMU33+jQkyreqHyG6dmMTvIfaYu8lY RbVRFQO80ucTXL2Vlu3n96jeQfwtj4sLcuJb0oKO7xr4MIYuN7hRYSAHbpWHFFYwc2U7 kV7RQPl06tqo+8wljn+b6zD3aO55ziRIXg8+TTnrSch8bq0dfYC7S/3/5lkL3FwO9I98 9XXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=kZJWM4F6Z6unu/rs+8fm9uleDQhYGGgncRQjKQf/aDk=; b=pFpn8MtIKOSDhsByuHiLcaVjXt3wIIB27rBPH9VuGaBWWrtN6Ck+dmafZ6Bi6gSEej WElrolo8LDttB38jn6SaONXjodHuzuoILuLvgOSPsSLLfRhxZO6aWNhZg+tnZQX8HyBK GRHewGRuPAnyDJ9RRrczdMlhLMnr1RZWj2SCcslAwZ6eFWUGblLA6ZohqdtJ70+oXq0H eOCuRMFyfxG85rnrqQMFOYoVD5xsI3xZuW2t1rGlyYndjkAwIy0txJvgtVslYt+EPTfU k1nHw+f9zpXUujn81xG79uznL0Ihnyo7mNrLhMroI8O25Acf5TS5n1EKm/M8XudUUz5C vHJg== X-Gm-Message-State: AOAM531965giF2VQW+4JtTgIJgT4dZocMo/GPob1YnT7PF/JfUfo4GYT 3mt/4AaIXSvD1rev7/TU7UlSTcPcB8Q= X-Received: by 2002:a17:902:6b01:b0:13e:50bb:790f with SMTP id o1-20020a1709026b0100b0013e50bb790fmr1626001plk.42.1633380896502; Mon, 04 Oct 2021 13:54:56 -0700 (PDT) Received: from google.com ([2620:15c:211:201:db55:938c:e15a:4670]) by smtp.gmail.com with ESMTPSA id d60sm11539860pjk.49.2021.10.04.13.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 13:54:56 -0700 (PDT) Sender: Minchan Kim Date: Mon, 4 Oct 2021 13:54:54 -0700 From: Minchan Kim To: Brian Geffon Cc: Andrew Morton , Nitin Gupta , Sergey Senozhatsky , Jonathan Corbet , LKML , linux-doc@vger.kernel.org, linux-block@vger.kernel.org, Suleiman Souhlal , Jesse Barnes Subject: Re: [PATCH] zram: Allow backing device to be assigned after init Message-ID: References: <20211001181627.394921-1-bgeffon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 02:40:52PM -0400, Brian Geffon wrote: > On Mon, Oct 4, 2021 at 2:29 PM Minchan Kim wrote: > > > > On Fri, Oct 01, 2021 at 11:16:27AM -0700, Brian Geffon wrote: > > > There does not appear to be a technical reason to not > > > allow the zram backing device to be assigned after the > > > zram device is initialized. > > > > > > This change will allow for the backing device to be assigned > > > as long as no backing device is already assigned. In that > > > event backing_dev would return -EEXIST. > > > > > > Signed-off-by: Brian Geffon > > > --- > > > drivers/block/zram/zram_drv.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > > > index fcaf2750f68f..12b4555ee079 100644 > > > --- a/drivers/block/zram/zram_drv.c > > > +++ b/drivers/block/zram/zram_drv.c > > > @@ -462,9 +462,9 @@ static ssize_t backing_dev_store(struct device *dev, > > > return -ENOMEM; > > > > > > down_write(&zram->init_lock); > > > - if (init_done(zram)) { > > > - pr_info("Can't setup backing device for initialized device\n"); > > > - err = -EBUSY; > > > + if (zram->backing_dev) { > > > + pr_info("Backing device is already assigned\n"); > > > + err = -EEXIST; > > > goto out; > > > > Hi Brian, > > > > Hi Minchan, > > > I am worry about the inconsistency with other interface of current zram > > set up. They were supposed to set it up before zram disksize setting > > because it makes code more simple/maintainalbe in that we don't need > > to check some feature on the fly. > > > > Let's think about when zram extends the writeback of incompressible > > page on demand. The write path will need the backing_dev under > > down_read(&zarm->init_lock) or other conditional variable to check > > whether the feature is enabled or not on the fly. > > I don't follow what you mean by that, writeback_store already holds > down_read(&zarm->init_lock). I should have explained a bit more. Sorry about that. I am thinking about a feature to deal with incompressible page. Let's have an example to handle incompressible page for that. zram_bvec_rw zram_bvec_write if (comp_len >= huge_class) zs_page_writeback down_read(&zram->init_lock) or some other way It's just idea for incompressible page but we might intorduce the way for other compresible pages, too at some condition.