Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1002238pxb; Tue, 26 Oct 2021 00:38:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/TWaeYzpSlTrS1o5N0EIhZMTLqaJD9gbYBmz+tBUDMCIfXJAn3jMr+mMOv9YF89jDHGeP X-Received: by 2002:a05:6402:2789:: with SMTP id b9mr32778897ede.142.1635233892808; Tue, 26 Oct 2021 00:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635233892; cv=none; d=google.com; s=arc-20160816; b=GP9gSStqO/M7otxclDz6hOf1TYN51OgZlXTP/6QKfnYHlTB6Xi5xN3w39qE5KEk1wH nsHdliKJwJxzH95smh5FDJFB41CpoG/C7xc31rc2Oyh5vxQ1uvUFnawlxHSQWPgVNjrg TZBprg4Pxwey2O2fGnTclnzsw1Q3T5QJN5L9DwQoUiQDtHVlY/MN+3scM6JcSOTItl0j FGLVTSTcjSdIbaZ4+I7BJjgexeC5vGCdZS/lMk3lV7Llmk19ZgOXFgMd4BgTLkyhu58U 6Q6rJR56+GxNQBIS5QUUOx15zpI93g3Z5rWrZPWdwrceipgt09UmpV66uCyuefpusUYt sKlg== 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:dkim-signature; bh=/xlS5pWGfijDqH/0h95+7pir2Zol9NoZmsyYQ20M0i8=; b=F+HQS/8r3sXdGiCtxwtG3rC+v0XZpEnovA9Ik/V9xRitkvaHBpiwkClind0hDf7rQf NdYdd+Ka/KOZ7DxFCrUpvhb1bQpsZ3Y8R9uYfp+QZwUm4hQRAP6IsR0z2EkVfQ0ccT4D Rz3JZ7RmNC7/MRhKD2LG1zc7rUH8ySUbQ0wLNnmPoErN5qsN0H/QZ/CsJtLVRYVX9i/Q Che32+I96BRKihk45emnX5r8K1C3MwlM8z7gh+NNIvB9wigUYEjPgQxiZF71ZDhTdVc3 7LPjyzEL6b2A5TBRL9agjZjgZ0vfig7DgAKsNPkSRKmssp1tJnNXbVjyoUv9CJsecRdK +ELQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=hXcUGn2i; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si26148846ejr.127.2021.10.26.00.37.42; Tue, 26 Oct 2021 00:38:12 -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=@suse.com header.s=susede1 header.b=hXcUGn2i; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233864AbhJZHRt (ORCPT + 99 others); Tue, 26 Oct 2021 03:17:49 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:44062 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhJZHRr (ORCPT ); Tue, 26 Oct 2021 03:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 98263218E1; Tue, 26 Oct 2021 07:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635232523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/xlS5pWGfijDqH/0h95+7pir2Zol9NoZmsyYQ20M0i8=; b=hXcUGn2iG2kIKRbZ829U+xpUOhMCeB411AxbZ/7+oxyPM6TMDH8ozqO7EOE4NeTUJ74RXq vb46J+hjJZr7GmUsqoCGPxehY+kS2uljpOBCVmtE6tLDQ4qFJ2KQTW0iZPzAltmpP3zuKR XUvVZhcUSugBiKeMOMLDoWhaM8sGqrc= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 64969A3B81; Tue, 26 Oct 2021 07:15:23 +0000 (UTC) Date: Tue, 26 Oct 2021 09:15:21 +0200 From: Michal Hocko To: NeilBrown Cc: linux-mm@kvack.org, Dave Chinner , Andrew Morton , Christoph Hellwig , Uladzislau Rezki , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [PATCH 4/4] mm: allow !GFP_KERNEL allocations for kvmalloc Message-ID: References: <20211025150223.13621-1-mhocko@kernel.org> <20211025150223.13621-5-mhocko@kernel.org> <163520487423.16092.18303917539436351482@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163520487423.16092.18303917539436351482@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 26-10-21 10:34:34, Neil Brown wrote: > On Tue, 26 Oct 2021, Michal Hocko wrote: > > From: Michal Hocko > > > > A support for GFP_NO{FS,IO} and __GFP_NOFAIL has been implemented > > by previous patches so we can allow the support for kvmalloc. This > > will allow some external users to simplify or completely remove > > their helpers. > > > > GFP_NOWAIT semantic hasn't been supported so far but it hasn't been > > explicitly documented so let's add a note about that. > > > > ceph_kvmalloc is the first helper to be dropped and changed to > > kvmalloc. > > > > Signed-off-by: Michal Hocko > > --- > > include/linux/ceph/libceph.h | 1 - > > mm/util.c | 15 ++++----------- > > net/ceph/buffer.c | 4 ++-- > > net/ceph/ceph_common.c | 27 --------------------------- > > net/ceph/crypto.c | 2 +- > > net/ceph/messenger.c | 2 +- > > net/ceph/messenger_v2.c | 2 +- > > net/ceph/osdmap.c | 12 ++++++------ > > 8 files changed, 15 insertions(+), 50 deletions(-) > > > > diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h > > index 409d8c29bc4f..309acbcb5a8a 100644 > > --- a/include/linux/ceph/libceph.h > > +++ b/include/linux/ceph/libceph.h > > @@ -295,7 +295,6 @@ extern bool libceph_compatible(void *data); > > > > extern const char *ceph_msg_type_name(int type); > > extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); > > -extern void *ceph_kvmalloc(size_t size, gfp_t flags); > > > > struct fs_parameter; > > struct fc_log; > > diff --git a/mm/util.c b/mm/util.c > > index bacabe446906..fdec6b4b1267 100644 > > --- a/mm/util.c > > +++ b/mm/util.c > > @@ -549,13 +549,10 @@ EXPORT_SYMBOL(vm_mmap); > > * Uses kmalloc to get the memory but if the allocation fails then falls back > > * to the vmalloc allocator. Use kvfree for freeing the memory. > > * > > - * Reclaim modifiers - __GFP_NORETRY and __GFP_NOFAIL are not supported. > > + * Reclaim modifiers - __GFP_NORETRY and GFP_NOWAIT are not supported. > > GFP_NOWAIT is not a modifier. It is a base value that can be modified. > I think you mean that > __GFP_NORETRY is not supported and __GFP_DIRECT_RECLAIM is required I thought naming the higher level gfp mask would be more helpful here. Most people do not tend to think in terms of __GFP_DIRECT_RECLAIM but rather GFP_NOWAIT or GFP_ATOMIC. > But I really cannot see why either of these statements are true. The reason is same as why vmalloc do not support neither of them. > Before your patch, __GFP_NORETRY would have forced use of kmalloc, so > that would mean it isn't really supported. But that doesn't happen any more. __GFP_NORETRY is used internaly by kvmalloc but that doesn't mean it is supported by the caller. In fact __GFP_NORETRY is used to implement a higher level logic of the prioritization between kmalloc and vmalloc fallback because some users would rather see vmalloc fallback even for smaller allocations which do not really fail otherwise (e.g. < order-4). -- Michal Hocko SUSE Labs