Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1590995pxb; Fri, 6 Nov 2020 13:52:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRVp3r81NRZIThpdPL6DhE3SvRSOX3+YManBGl/madntaqWZSrLkDqJgMAz1BmAkhDgNSl X-Received: by 2002:a17:906:35da:: with SMTP id p26mr4155452ejb.256.1604699567171; Fri, 06 Nov 2020 13:52:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604699567; cv=none; d=google.com; s=arc-20160816; b=FaQO61YHRO7fFHDu88A0e4VMw1EFkbZ8qVhWRc4q/9aFOHYKCxZTi0WxUq12yhnoBm iESNpgTbvAVKwY6DWXCbmUWsCeouzS7uyCLT43hH/0KWMDZsLSM0m/gbpHls9pMWHNfN ZLCINt/ehQE6pzdmflRmJHA0Pzev4c3Au/MQQ/ITPunEV82rNeaTHZ4KblZ4dmHdsjZd Fx0caEmXu31Mx+mYKUHpkZoJpi/W8ga8SYkShrPKsowDsAdVxBCUuO6DPYTOz4nHqvp6 FBI3X6WXsi6advv6y1m/ixarjgfS0w5f804UNnw53caTvzHZc3OhRRZi1tILOuwG7IuX lSLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=9FlJEdCBypkoSaNwr8y05npAfUl3p+m6UrQhT0+QP9Q=; b=rl9A325NPWay682VHw/UL+LiCGbdPuu0T2Aa9J9t5wEBhnuwm1SeVFGeaMTgFKeSU/ LjOZ7hS3T04qCpouvJnR92N0A5ed4q5CbicVWu4zHk/7DqA6W8YrwVDmhXrLf7NmJN2A YjjWBx5u4c6IQLsJ6UsLroUE3QaMhulaAJKnNEAV5tkBIBKDYwnI+tHf8slivXmi02Sw JyAU/Enwp4UFQOaK0/ZNDHXVOsFKMUS98iGX/VK4liBMMBmELVWYQnme8Xcqme3DxBcG RuczJRll7kL38yyBTl30ekkzoGr/MdhrIo2oTdCk7aWSe+Yf/dJP7AIiOxCUlscF4Dsj qrKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b="PU/TPClO"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si1759805ejy.346.2020.11.06.13.52.23; Fri, 06 Nov 2020 13:52:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@fieldses.org header.s=default header.b="PU/TPClO"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728639AbgKFVv3 (ORCPT + 99 others); Fri, 6 Nov 2020 16:51:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728464AbgKFVv2 (ORCPT ); Fri, 6 Nov 2020 16:51:28 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1683C0613CF for ; Fri, 6 Nov 2020 13:51:28 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id 5BF1C4F3A; Fri, 6 Nov 2020 16:51:28 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 5BF1C4F3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1604699488; bh=9FlJEdCBypkoSaNwr8y05npAfUl3p+m6UrQhT0+QP9Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PU/TPClO3jHXOK4nFwhSsLprkjiS8Z2BDU7xnE5yrH3ozFnvN9EeQiHwHehvsjrA5 UoQgMMua8odMwPaBWROFNSJUiRk/NbEuYGrkCcRkrIKYg/h6Jr4V8Y50z/yo58EKhh JlrvA9kHIJk63h/O1QOipgZpS20zw0iDuBrW8JEg= Date: Fri, 6 Nov 2020 16:51:28 -0500 From: "J. Bruce Fields" To: Roberto Bergantinos Corpas Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH] sunrpc : make RPC channel buffer dynamic for slow case Message-ID: <20201106215128.GD26028@fieldses.org> References: <20201026150530.29019-1-rbergant@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026150530.29019-1-rbergant@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Oct 26, 2020 at 04:05:30PM +0100, Roberto Bergantinos Corpas wrote: > RPC channel buffer size for slow case (user buffer bigger than > one page) can be converted into dymanic and also allows us to > prescind from queue_io_mutex Sorry for the slow response. Let's just remove cache_slow_downcall and the find_or_create_page() thing and just do a kvmalloc() from the start. I don't understand why we need to be more complicated. --b. > > Signed-off-by: Roberto Bergantinos Corpas > --- > net/sunrpc/cache.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c > index baef5ee43dbb..325393f75e17 100644 > --- a/net/sunrpc/cache.c > +++ b/net/sunrpc/cache.c > @@ -777,7 +777,6 @@ void cache_clean_deferred(void *owner) > */ > > static DEFINE_SPINLOCK(queue_lock); > -static DEFINE_MUTEX(queue_io_mutex); > > struct cache_queue { > struct list_head list; > @@ -908,14 +907,18 @@ static ssize_t cache_do_downcall(char *kaddr, const char __user *buf, > static ssize_t cache_slow_downcall(const char __user *buf, > size_t count, struct cache_detail *cd) > { > - static char write_buf[8192]; /* protected by queue_io_mutex */ > + char *write_buf; > ssize_t ret = -EINVAL; > > - if (count >= sizeof(write_buf)) > + if (count >= 32768) /* 32k is max userland buffer, lets check anyway */ > goto out; > - mutex_lock(&queue_io_mutex); > + > + write_buf = kvmalloc(count + 1, GFP_KERNEL); > + if (!write_buf) > + return -ENOMEM; > + > ret = cache_do_downcall(write_buf, buf, count, cd); > - mutex_unlock(&queue_io_mutex); > + kvfree(write_buf); > out: > return ret; > } > -- > 2.21.0