From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933261AbdABPzb (ORCPT ); Mon, 2 Jan 2017 10:55:31 -0500 Received: from smtprelay0168.hostedemail.com ([216.40.44.168]:48430 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751388AbdABPz3 (ORCPT ); Mon, 2 Jan 2017 10:55:29 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6742:7576:10004:10400:10450:10455:10848:11232:11658:11914:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:19904:19999:21080:21433:21451:30012:30051:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: desk74_4c45097b31f2e X-Filterd-Recvd-Size: 2776 Message-ID: <1483372522.1955.20.camel@perches.com> Subject: Re: [PATCH] mm: introduce kv[mz]alloc helpers From: Joe Perches To: Michal Hocko , Andrew Morton Cc: 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, Michal Hocko , Anatoly Stepanov , Paolo Bonzini , Mike Snitzer , "Michael S. Tsirkin" , "Theodore Ts'o" , Andreas Dilger Date: Mon, 02 Jan 2017 07:55:22 -0800 In-Reply-To: <20170102133700.1734-1-mhocko@kernel.org> References: <20170102133700.1734-1-mhocko@kernel.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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