Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2774010ybh; Mon, 9 Mar 2020 12:43:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtaJRcaPoF/CjQXv4M7jUNlUfHKwJ+RQIbyFSM9ON9dFf1P9WxZtkH1L8VbOudoqqu1EYaX X-Received: by 2002:a05:6808:14d:: with SMTP id h13mr14721oie.121.1583783015333; Mon, 09 Mar 2020 12:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583783015; cv=none; d=google.com; s=arc-20160816; b=DhuK7m8SKwed0QtKGVhfqIA1ZGkSE71z3zdE0pAf2SJW+qq46cu8Bp091idOPAToTe NtXIPB1h/f5Z+cJ1rxpa+zGNJ/GKmHubJWGhM7Gp9S/i0itFL0e8wx0B6SVA+JQvKlC0 L+bUZ3NOdbMHD+YbAzry2pkEa/be8NES1g9DxHdjugFa7j2pP1+UDAD3LqeNqTS/N0Pl R1OIRsI9eKuoPCWJiygN8GBRmjBj1PoKT6s6a/O2zgK6A2B5Vj1FYKlCL5EFcpDSxuC/ 7Mh/eVWfSjcjf8U4vcGef7SXj+gT2FfSv5VrdnHvCsmP50EHTBMIDLAnm08RUE2wigu6 +dag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=US/u7mhx8GdTI259+XrFiLsfqaPH0ky196pdpDKttKQ=; b=vvsH6U5HgUgIgUnsNzuE9c057cyBHi2vy/1yvexvEZGBW211oVEK1sre8oTh5U8CDE iytmZWTzv8qx1cuvlHB45ZAzfwHbuCokUsxs2Q+NH8ysEIeK/rZBIuMPqFuSBZj5kiI1 yPLt/QnmvwOqYBUFMUAZpDvxivg9gVkcWpIJ03zD4XVFthgBONFQcJdaM7NzUTizQZX+ Ys2Cu87O6dLW4Xi141DGL1xkGxT/y/HpVRfOoinOqLCVN4YJS5QMSf8mW44kOdlxt5vN zfSvp0pTjdprtLyKlqh0h9xxmQ/NlQYpYReLtzu3UM0wv+IDKJHZX1oK4QBWY3jJI/Zq svOw== ARC-Authentication-Results: i=1; mx.google.com; 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 x4si6076646oto.217.2020.03.09.12.43.23; Mon, 09 Mar 2020 12:43:35 -0700 (PDT) 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; 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 S1726487AbgCITmt (ORCPT + 99 others); Mon, 9 Mar 2020 15:42:49 -0400 Received: from smtprelay0204.hostedemail.com ([216.40.44.204]:45016 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725992AbgCITms (ORCPT ); Mon, 9 Mar 2020 15:42:48 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 4FE3118224D82; Mon, 9 Mar 2020 19:42:47 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2692:2731:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3871:3872:3873:4321:5007:6119:7903:8603:8828:10004:10400:10848:11026:11232:11658:11914:12048:12296:12297:12740:12760:12895:13069:13071:13311:13357:13439:14180:14659:14721:21060:21080:21627:21990:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: steel13_8c8a845334d15 X-Filterd-Recvd-Size: 2076 Received: from XPS-9350.home (unknown [47.151.143.254]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Mon, 9 Mar 2020 19:42:45 +0000 (UTC) Message-ID: <6bbfc8b8c9c206d80de43a64bfe4b8083cc2c02f.camel@perches.com> Subject: Re: [PATCH v2 1/4] kernfs: kvmalloc xattr value instead of kmalloc From: Joe Perches To: Daniel Xu , cgroups@vger.kernel.org, tj@kernel.org, lizefan@huawei.com, hannes@cmpxchg.org Cc: shakeelb@google.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, kernel-team@fb.com Date: Mon, 09 Mar 2020 12:41:05 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-03-09 at 11:21 -0700, Daniel Xu wrote: > Hi Joe, Hello Daniel. > On Fri Mar 6, 2020 at 12:49 AM, Joe Perches wrote: > > On Thu, 2020-03-05 at 13:16 -0800, Daniel Xu wrote: > > > It's not really necessary to have contiguous physical memory for xattr > > > values. We no longer need to worry about higher order allocations > > > failing with kvmalloc, especially because the xattr size limit is at > > > 64K. > > > > So why use vmalloc memory at all? > > > > > > > diff --git a/fs/xattr.c b/fs/xattr.c > > '] > > > @@ -817,7 +817,7 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size) > > > if (len < sizeof(*new_xattr)) > > > return NULL; > > > > > > - new_xattr = kmalloc(len, GFP_KERNEL); > > > + new_xattr = kvmalloc(len, GFP_KERNEL); > > > > Why is this sensible? > > vmalloc memory is a much more limited resource. > > What would be the alternative? As Greg said, contiguous memory should be > more scarce. If the need is to allocate from a single block of memory, perhaps you need a submemory allocator like gen_pool. (gennalloc.h) Dunno. Maybe i just don't quite understand your need.