From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751891AbdAYNkX (ORCPT ); Wed, 25 Jan 2017 08:40:23 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34398 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbdAYNkT (ORCPT ); Wed, 25 Jan 2017 08:40:19 -0500 MIME-Version: 1.0 In-Reply-To: <20170125130901.GP32377@dhcp22.suse.cz> References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> <20170112173745.GC31509@dhcp22.suse.cz> <7c109e9e-e28b-3ddb-42b6-902f46bf0572@suse.cz> <20170124150004.GM6867@dhcp22.suse.cz> <20170125130901.GP32377@dhcp22.suse.cz> From: Ilya Dryomov Date: Wed, 25 Jan 2017 14:40:17 +0100 Message-ID: Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants To: Michal Hocko Cc: Vlastimil Babka , Kees Cook , Andrew Morton , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , Linux-MM , LKML , Martin Schwidefsky , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Tariq Toukan , Yishai Hadas , Dan Williams , Oleg Drokin , Andreas Dilger , Boris Ostrovsky , David Sterba , "Yan, Zheng" , Alexei Starovoitov , Eric Dumazet , Network Development Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 25, 2017 at 2:09 PM, Michal Hocko wrote: > On Wed 25-01-17 12:15:59, Vlastimil Babka wrote: >> On 01/24/2017 04:00 PM, Michal Hocko wrote: >> > > > Well, I am not opposed to kvmalloc_array but I would argue that this >> > > > conversion cannot introduce new overflow issues. The code would have >> > > > to be broken already because even though kmalloc_array checks for the >> > > > overflow but vmalloc fallback doesn't... >> > > >> > > Yeah I agree, but if some of the places were really wrong, after the >> > > conversion we won't see them anymore. >> > > >> > > > If there is a general interest for this API I can add it. >> > > >> > > I think it would be better, yes. >> > >> > OK, fair enough. I will fold the following into the original patch. I >> > was little bit reluctant to create kvcalloc so I've made the original >> > callers more talkative and added | __GFP_ZERO. >> >> Fair enough, >> >> > To be honest I do not >> > really like how kcalloc... >> >> how kcalloc what? > > how kcalloc hides the GFP_ZERO and the name doesn't reflect that. The userspace calloc() is specified to zero memory, so I'd say the name does reflect that. Thanks, Ilya From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Dryomov Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Date: Wed, 25 Jan 2017 14:40:17 +0100 Message-ID: References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> <20170112173745.GC31509@dhcp22.suse.cz> <7c109e9e-e28b-3ddb-42b6-902f46bf0572@suse.cz> <20170124150004.GM6867@dhcp22.suse.cz> <20170125130901.GP32377@dhcp22.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Vlastimil Babka , Kees Cook , Andrew Morton , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , Linux-MM , LKML , Martin Schwidefsky , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S Return-path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:34398 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbdAYNkT (ORCPT ); Wed, 25 Jan 2017 08:40:19 -0500 In-Reply-To: <20170125130901.GP32377@dhcp22.suse.cz> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Jan 25, 2017 at 2:09 PM, Michal Hocko wrote: > On Wed 25-01-17 12:15:59, Vlastimil Babka wrote: >> On 01/24/2017 04:00 PM, Michal Hocko wrote: >> > > > Well, I am not opposed to kvmalloc_array but I would argue that this >> > > > conversion cannot introduce new overflow issues. The code would have >> > > > to be broken already because even though kmalloc_array checks for the >> > > > overflow but vmalloc fallback doesn't... >> > > >> > > Yeah I agree, but if some of the places were really wrong, after the >> > > conversion we won't see them anymore. >> > > >> > > > If there is a general interest for this API I can add it. >> > > >> > > I think it would be better, yes. >> > >> > OK, fair enough. I will fold the following into the original patch. I >> > was little bit reluctant to create kvcalloc so I've made the original >> > callers more talkative and added | __GFP_ZERO. >> >> Fair enough, >> >> > To be honest I do not >> > really like how kcalloc... >> >> how kcalloc what? > > how kcalloc hides the GFP_ZERO and the name doesn't reflect that. The userspace calloc() is specified to zero memory, so I'd say the name does reflect that. Thanks, Ilya From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id A4BB56B0033 for ; Wed, 25 Jan 2017 08:40:19 -0500 (EST) Received: by mail-wm0-f70.google.com with SMTP id r144so38144800wme.0 for ; Wed, 25 Jan 2017 05:40:19 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com. [2a00:1450:400c:c09::241]) by mx.google.com with ESMTPS id f87si22439244wmh.24.2017.01.25.05.40.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 05:40:18 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id c85so42529411wmi.1 for ; Wed, 25 Jan 2017 05:40:18 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20170125130901.GP32377@dhcp22.suse.cz> References: <20170112153717.28943-1-mhocko@kernel.org> <20170112153717.28943-6-mhocko@kernel.org> <20170112173745.GC31509@dhcp22.suse.cz> <7c109e9e-e28b-3ddb-42b6-902f46bf0572@suse.cz> <20170124150004.GM6867@dhcp22.suse.cz> <20170125130901.GP32377@dhcp22.suse.cz> From: Ilya Dryomov Date: Wed, 25 Jan 2017 14:40:17 +0100 Message-ID: Subject: Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: Vlastimil Babka , Kees Cook , Andrew Morton , David Rientjes , Mel Gorman , Johannes Weiner , Al Viro , Linux-MM , LKML , Martin Schwidefsky , Heiko Carstens , Herbert Xu , Anton Vorontsov , Colin Cross , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Tariq Toukan , Yishai Hadas , Dan Williams , Oleg Drokin , Andreas Dilger , Boris Ostrovsky , David Sterba , "Yan, Zheng" , Alexei Starovoitov , Eric Dumazet , Network Development On Wed, Jan 25, 2017 at 2:09 PM, Michal Hocko wrote: > On Wed 25-01-17 12:15:59, Vlastimil Babka wrote: >> On 01/24/2017 04:00 PM, Michal Hocko wrote: >> > > > Well, I am not opposed to kvmalloc_array but I would argue that this >> > > > conversion cannot introduce new overflow issues. The code would have >> > > > to be broken already because even though kmalloc_array checks for the >> > > > overflow but vmalloc fallback doesn't... >> > > >> > > Yeah I agree, but if some of the places were really wrong, after the >> > > conversion we won't see them anymore. >> > > >> > > > If there is a general interest for this API I can add it. >> > > >> > > I think it would be better, yes. >> > >> > OK, fair enough. I will fold the following into the original patch. I >> > was little bit reluctant to create kvcalloc so I've made the original >> > callers more talkative and added | __GFP_ZERO. >> >> Fair enough, >> >> > To be honest I do not >> > really like how kcalloc... >> >> how kcalloc what? > > how kcalloc hides the GFP_ZERO and the name doesn't reflect that. The userspace calloc() is specified to zero memory, so I'd say the name does reflect that. Thanks, Ilya -- 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