From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751160AbdA3Qem (ORCPT ); Mon, 30 Jan 2017 11:34:42 -0500 Received: from mx2.suse.de ([195.135.220.15]:46354 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751517AbdA3QeY (ORCPT ); Mon, 30 Jan 2017 11:34:24 -0500 Subject: Re: [PATCH 5/9] treewide: use kv[mz]alloc* rather than opencoded variants To: Michal Hocko , Andrew Morton References: <20170130094940.13546-1-mhocko@kernel.org> <20170130094940.13546-6-mhocko@kernel.org> Cc: 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 , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Yishai Hadas , Oleg Drokin , "Yan, Zheng" , Alexei Starovoitov , Eric Dumazet , netdev@vger.kernel.org From: Vlastimil Babka Message-ID: <9793f9d3-4ef1-aad0-b38f-d8760e536ff9@suse.cz> Date: Mon, 30 Jan 2017 17:14:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170130094940.13546-6-mhocko@kernel.org> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30/2017 10:49 AM, 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 <= 32kB (with 4kB pages) 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. > > Changes since v1 > - add kvmalloc_array - this might silently fix some overflow issues > because most users simply didn't check the overflow for the vmalloc > fallback. > > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Herbert Xu > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Kees Cook > Cc: Tony Luck > Cc: "Rafael J. Wysocki" > Cc: Ben Skeggs > Cc: Kent Overstreet > Cc: Santosh Raspatur > Cc: Hariprasad S > Cc: Yishai Hadas > Cc: Oleg Drokin > Cc: "Yan, Zheng" > Cc: Alexander Viro > Cc: Alexei Starovoitov > Cc: Eric Dumazet > Cc: netdev@vger.kernel.org > Acked-by: Andreas Dilger # Lustre > Reviewed-by: Boris Ostrovsky # Xen bits > Acked-by: Christian Borntraeger # KVM/s390 > Acked-by: Dan Williams # nvdim > Acked-by: David Sterba # btrfs > Acked-by: Ilya Dryomov # Ceph > Acked-by: Tariq Toukan # mlx4 > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vlastimil Babka Subject: Re: [PATCH 5/9] treewide: use kv[mz]alloc* rather than opencoded variants Date: Mon, 30 Jan 2017 17:14:21 +0100 Message-ID: <9793f9d3-4ef1-aad0-b38f-d8760e536ff9@suse.cz> References: <20170130094940.13546-1-mhocko@kernel.org> <20170130094940.13546-6-mhocko@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 7bit Cc: 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 , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Yishai Hadas , Oleg Drokin , "Yan, Zheng" , Alexei Starovoitov , Eric Dumazet , net To: Michal Hocko , Andrew Morton Return-path: In-Reply-To: <20170130094940.13546-6-mhocko@kernel.org> Sender: owner-linux-mm@kvack.org List-Id: netdev.vger.kernel.org On 01/30/2017 10:49 AM, 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 <= 32kB (with 4kB pages) 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. > > Changes since v1 > - add kvmalloc_array - this might silently fix some overflow issues > because most users simply didn't check the overflow for the vmalloc > fallback. > > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Herbert Xu > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Kees Cook > Cc: Tony Luck > Cc: "Rafael J. Wysocki" > Cc: Ben Skeggs > Cc: Kent Overstreet > Cc: Santosh Raspatur > Cc: Hariprasad S > Cc: Yishai Hadas > Cc: Oleg Drokin > Cc: "Yan, Zheng" > Cc: Alexander Viro > Cc: Alexei Starovoitov > Cc: Eric Dumazet > Cc: netdev@vger.kernel.org > Acked-by: Andreas Dilger # Lustre > Reviewed-by: Boris Ostrovsky # Xen bits > Acked-by: Christian Borntraeger # KVM/s390 > Acked-by: Dan Williams # nvdim > Acked-by: David Sterba # btrfs > Acked-by: Ilya Dryomov # Ceph > Acked-by: Tariq Toukan # mlx4 > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka -- 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-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id B95FA6B0272 for ; Mon, 30 Jan 2017 11:14:26 -0500 (EST) Received: by mail-wm0-f71.google.com with SMTP id r18so9979798wmd.1 for ; Mon, 30 Jan 2017 08:14:26 -0800 (PST) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id i3si13927029wmd.88.2017.01.30.08.14.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 30 Jan 2017 08:14:25 -0800 (PST) Subject: Re: [PATCH 5/9] treewide: use kv[mz]alloc* rather than opencoded variants References: <20170130094940.13546-1-mhocko@kernel.org> <20170130094940.13546-6-mhocko@kernel.org> From: Vlastimil Babka Message-ID: <9793f9d3-4ef1-aad0-b38f-d8760e536ff9@suse.cz> Date: Mon, 30 Jan 2017 17:14:21 +0100 MIME-Version: 1.0 In-Reply-To: <20170130094940.13546-6-mhocko@kernel.org> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko , Andrew Morton Cc: 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 , Tony Luck , "Rafael J. Wysocki" , Ben Skeggs , Kent Overstreet , Santosh Raspatur , Hariprasad S , Yishai Hadas , Oleg Drokin , "Yan, Zheng" , Alexei Starovoitov , Eric Dumazet , netdev@vger.kernel.org On 01/30/2017 10:49 AM, 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 <= 32kB (with 4kB pages) 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. > > Changes since v1 > - add kvmalloc_array - this might silently fix some overflow issues > because most users simply didn't check the overflow for the vmalloc > fallback. > > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Herbert Xu > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Kees Cook > Cc: Tony Luck > Cc: "Rafael J. Wysocki" > Cc: Ben Skeggs > Cc: Kent Overstreet > Cc: Santosh Raspatur > Cc: Hariprasad S > Cc: Yishai Hadas > Cc: Oleg Drokin > Cc: "Yan, Zheng" > Cc: Alexander Viro > Cc: Alexei Starovoitov > Cc: Eric Dumazet > Cc: netdev@vger.kernel.org > Acked-by: Andreas Dilger # Lustre > Reviewed-by: Boris Ostrovsky # Xen bits > Acked-by: Christian Borntraeger # KVM/s390 > Acked-by: Dan Williams # nvdim > Acked-by: David Sterba # btrfs > Acked-by: Ilya Dryomov # Ceph > Acked-by: Tariq Toukan # mlx4 > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka -- 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