From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933209AbdABQC5 (ORCPT ); Mon, 2 Jan 2017 11:02:57 -0500 Received: from mx2.suse.de ([195.135.220.15]:52776 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755577AbdABQCz (ORCPT ); Mon, 2 Jan 2017 11:02:55 -0500 Date: Mon, 2 Jan 2017 17:02:50 +0100 From: Michal Hocko To: Joe Perches Cc: Andrew Morton , Vlastimil Babka , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , linux-mm@kvack.org, LKML , kvm@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-ext4@vger.kernel.org, Anatoly Stepanov , Paolo Bonzini , Mike Snitzer , "Michael S. Tsirkin" , "Theodore Ts'o" , Andreas Dilger Subject: Re: [PATCH] mm: introduce kv[mz]alloc helpers Message-ID: <20170102160249.GA11635@dhcp22.suse.cz> References: <20170102133700.1734-1-mhocko@kernel.org> <1483372522.1955.20.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1483372522.1955.20.camel@perches.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 02-01-17 07:55:22, Joe Perches wrote: > On Mon, 2017-01-02 at 14:37 +0100, Michal Hocko wrote: > > From: Michal Hocko > > > > Using kmalloc with the vmalloc fallback for larger allocations is a > > common pattern in the kernel code. Yet we do not have any common helper > > for that and so users have invented their own helpers. Some of them are > > really creative when doing so. Let's just add kv[mz]alloc and make sure > > it is implemented properly. This implementation makes sure to not make > > a large memory pressure for > PAGE_SZE requests (__GFP_NORETRY) and also > > to not warn about allocation failures. This also rules out the OOM > > killer as the vmalloc is a more approapriate fallback than a disruptive > > user visible action. > > > > This patch also changes some existing users and removes helpers which > > are specific for them. In some cases this is not possible (e.g. > > ext4_kvmalloc, libcfs_kvzalloc, __aa_kvmalloc) because those seems to be > > broken and require GFP_NO{FS,IO} context which is not vmalloc compatible > > in general (note that the page table allocation is GFP_KERNEL). Those > > need to be fixed separately. > > > > apparmor has already claimed kv[mz]alloc so remove those and use > > __aa_kvmalloc instead to prevent from the naming clashes. > > I have no real objection but perhaps this would > be better done as 3 or more patches > > o rename apparmor uses > o introduce generic > o conversions to generic Whatever maintainers of the respective code prefer. I usually prefer to have newly introduced functions along with their users so that it is clear how they are used. The patch doesn't seem to be too large either... -- Michal Hocko SUSE Labs