From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750950AbdAMBL4 convert rfc822-to-8bit (ORCPT ); Thu, 12 Jan 2017 20:11:56 -0500 Received: from mga09.intel.com ([134.134.136.24]:52276 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbdAMBLy (ORCPT ); Thu, 12 Jan 2017 20:11:54 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,220,1477983600"; d="scan'208";a="1111859918" From: "Dilger, Andreas" To: Michal Hocko CC: Andrew Morton , Vlastimil Babka , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , "linux-mm@kvack.org" , LKML , Michal Hocko , "Martin Schwidefsky" , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , "Kees Cook" , "Luck, Tony" , "Rafael J. Wysocki" , Ben Skeggs , "Kent Overstreet" , Santosh Raspatur , Hariprasad S , Tariq Toukan , Yishai Hadas , "Williams, Dan J" , "Drokin, Oleg" , "Boris Ostrovsky" , David Sterba , "Yan, Zheng" , Ilya Dryomov , "Alexei Starovoitov" , Eric Dumazet , "netdev@vger.kernel.org" Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Thread-Topic: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Thread-Index: AQHSbOnLbMNUn8GgykGK1QhVlt3SXaE2IFCA Date: Fri, 13 Jan 2017 01:11:51 +0000 Message-ID: <0B164192-F549-4D5E-BB07-B51886D936B0@intel.com> References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> In-Reply-To: <20170112153717.28943-6-mhocko@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.94.24] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 12, 2017, at 08:37, Michal Hocko wrote: > > From: Michal Hocko > > There are many code paths opencoding kvmalloc. Let's use the helper > instead. The main difference to kvmalloc is that those users are usually > not considering all the aspects of the memory allocator. E.g. allocation > requests < 64kB are basically never failing and invoke OOM killer to > satisfy the allocation. This sounds too disruptive for something that > has a reasonable fallback - the vmalloc. On the other hand those > requests might fallback to vmalloc even when the memory allocator would > succeed after several more reclaim/compaction attempts previously. There > is no guarantee something like that happens though. > > This patch converts many of those places to kv[mz]alloc* helpers because > they are more conservative. > > Signed-off-by: Michal Hocko Lustre part can be Acked-by: Andreas Dilger [snip] > diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > index a6a76a681ea9..8f638267e704 100644 > --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > @@ -45,15 +45,6 @@ EXPORT_SYMBOL(libcfs_kvzalloc); > void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t size, > gfp_t flags) > { > - void *ret; > - > - ret = kzalloc_node(size, flags | __GFP_NOWARN, > - cfs_cpt_spread_node(cptab, cpt)); > - if (!ret) { > - WARN_ON(!(flags & (__GFP_FS | __GFP_HIGH))); > - ret = vmalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); > - } > - > - return ret; > + return kvzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt)); > } > EXPORT_SYMBOL(libcfs_kvzalloc_cpt); From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dilger, Andreas" Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Date: Fri, 13 Jan 2017 01:11:51 +0000 Message-ID: <0B164192-F549-4D5E-BB07-B51886D936B0@intel.com> References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: Andrew Morton , Vlastimil Babka , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , "linux-mm@kvack.org" , LKML , Michal Hocko , "Martin Schwidefsky" , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , "Kees Cook" , "Luck, Tony" , "Rafael J. Wysocki" , Ben Skeggs , "Kent Overstreet" , Santosh Raspatur , Hariprasad S , Tariq Toukan , Yishai Hadas , "Will To: Michal Hocko Return-path: In-Reply-To: <20170112153717.28943-6-mhocko@kernel.org> Content-Language: en-US Content-ID: Sender: owner-linux-mm@kvack.org List-Id: netdev.vger.kernel.org > On Jan 12, 2017, at 08:37, Michal Hocko wrote: >=20 > From: Michal Hocko >=20 > There are many code paths opencoding kvmalloc. Let's use the helper > instead. The main difference to kvmalloc is that those users are usually > not considering all the aspects of the memory allocator. E.g. allocation > requests < 64kB are basically never failing and invoke OOM killer to > satisfy the allocation. This sounds too disruptive for something that > has a reasonable fallback - the vmalloc. On the other hand those > requests might fallback to vmalloc even when the memory allocator would > succeed after several more reclaim/compaction attempts previously. There > is no guarantee something like that happens though. >=20 > This patch converts many of those places to kv[mz]alloc* helpers because > they are more conservative. >=20 > Signed-off-by: Michal Hocko Lustre part can be Acked-by: Andreas Dilger [snip] > diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c b/drive= rs/staging/lustre/lnet/libcfs/linux/linux-mem.c > index a6a76a681ea9..8f638267e704 100644 > --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > @@ -45,15 +45,6 @@ EXPORT_SYMBOL(libcfs_kvzalloc); > void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t si= ze, > gfp_t flags) > { > - void *ret; > - > - ret =3D kzalloc_node(size, flags | __GFP_NOWARN, > - cfs_cpt_spread_node(cptab, cpt)); > - if (!ret) { > - WARN_ON(!(flags & (__GFP_FS | __GFP_HIGH))); > - ret =3D vmalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); > - } > - > - return ret; > + return kvzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt)); > } > EXPORT_SYMBOL(libcfs_kvzalloc_cpt); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 288876B0033 for ; Thu, 12 Jan 2017 20:11:55 -0500 (EST) Received: by mail-pf0-f199.google.com with SMTP id 80so89726026pfy.2 for ; Thu, 12 Jan 2017 17:11:55 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id z18si2448035pfg.247.2017.01.12.17.11.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jan 2017 17:11:54 -0800 (PST) From: "Dilger, Andreas" Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Date: Fri, 13 Jan 2017 01:11:51 +0000 Message-ID: <0B164192-F549-4D5E-BB07-B51886D936B0@intel.com> References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> In-Reply-To: <20170112153717.28943-6-mhocko@kernel.org> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: Andrew Morton , Vlastimil Babka , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , "linux-mm@kvack.org" , LKML , Michal Hocko , Martin Schwidefsky , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , Kees Cook , "Luck, Tony" , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Tariq Toukan , Yishai Hadas , "Williams, Dan J" , "Drokin, Oleg" , Boris Ostrovsky , David Sterba , "Yan, Zheng" , Ilya Dryomov , Alexei Starovoitov , Eric Dumazet , "netdev@vger.kernel.org" > On Jan 12, 2017, at 08:37, Michal Hocko wrote: >=20 > From: Michal Hocko >=20 > There are many code paths opencoding kvmalloc. Let's use the helper > instead. The main difference to kvmalloc is that those users are usually > not considering all the aspects of the memory allocator. E.g. allocation > requests < 64kB are basically never failing and invoke OOM killer to > satisfy the allocation. This sounds too disruptive for something that > has a reasonable fallback - the vmalloc. On the other hand those > requests might fallback to vmalloc even when the memory allocator would > succeed after several more reclaim/compaction attempts previously. There > is no guarantee something like that happens though. >=20 > This patch converts many of those places to kv[mz]alloc* helpers because > they are more conservative. >=20 > Signed-off-by: Michal Hocko Lustre part can be Acked-by: Andreas Dilger [snip] > diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c b/drive= rs/staging/lustre/lnet/libcfs/linux/linux-mem.c > index a6a76a681ea9..8f638267e704 100644 > --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c > @@ -45,15 +45,6 @@ EXPORT_SYMBOL(libcfs_kvzalloc); > void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t si= ze, > gfp_t flags) > { > - void *ret; > - > - ret =3D kzalloc_node(size, flags | __GFP_NOWARN, > - cfs_cpt_spread_node(cptab, cpt)); > - if (!ret) { > - WARN_ON(!(flags & (__GFP_FS | __GFP_HIGH))); > - ret =3D vmalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); > - } > - > - return ret; > + return kvzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt)); > } > EXPORT_SYMBOL(libcfs_kvzalloc_cpt); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org