From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756070AbdCTVcb (ORCPT ); Mon, 20 Mar 2017 17:32:31 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:36292 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753629AbdCTVca (ORCPT ); Mon, 20 Mar 2017 17:32:30 -0400 Date: Mon, 20 Mar 2017 14:32:27 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Huang, Ying" cc: Andrew Morton , Andi Kleen , Dave Hansen , Shaohua Li , Rik van Riel , Tim Chen , Michal Hocko , Mel Gorman , Aaron Lu , Gerald Schaefer , "Kirill A. Shutemov" , Hugh Dickins , Ingo Molnar , Vegard Nossum , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -v2 1/2] mm, swap: Use kvzalloc to allocate some swap data structure In-Reply-To: <20170320084732.3375-1-ying.huang@intel.com> Message-ID: References: <20170320084732.3375-1-ying.huang@intel.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Mar 2017, Huang, Ying wrote: > From: Huang Ying > > Now vzalloc() is used in swap code to allocate various data > structures, such as swap cache, swap slots cache, cluster info, etc. > Because the size may be too large on some system, so that normal > kzalloc() may fail. But using kzalloc() has some advantages, for > example, less memory fragmentation, less TLB pressure, etc. So change > the data structure allocation in swap code to use kvzalloc() which > will try kzalloc() firstly, and fallback to vzalloc() if kzalloc() > failed. > As questioned in -v1 of this patch, what is the benefit of directly compacting and reclaiming memory for high-order pages by first preferring kmalloc() if this does not require contiguous memory? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f72.google.com (mail-pg0-f72.google.com [74.125.83.72]) by kanga.kvack.org (Postfix) with ESMTP id AF10B6B038A for ; Mon, 20 Mar 2017 17:32:29 -0400 (EDT) Received: by mail-pg0-f72.google.com with SMTP id 81so281055534pgh.3 for ; Mon, 20 Mar 2017 14:32:29 -0700 (PDT) Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com. [2607:f8b0:400e:c05::229]) by mx.google.com with ESMTPS id o12si18881476plg.220.2017.03.20.14.32.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 14:32:29 -0700 (PDT) Received: by mail-pg0-x229.google.com with SMTP id n190so83474823pga.0 for ; Mon, 20 Mar 2017 14:32:29 -0700 (PDT) Date: Mon, 20 Mar 2017 14:32:27 -0700 (PDT) From: David Rientjes Subject: Re: [PATCH -v2 1/2] mm, swap: Use kvzalloc to allocate some swap data structure In-Reply-To: <20170320084732.3375-1-ying.huang@intel.com> Message-ID: References: <20170320084732.3375-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: "Huang, Ying" Cc: Andrew Morton , Andi Kleen , Dave Hansen , Shaohua Li , Rik van Riel , Tim Chen , Michal Hocko , Mel Gorman , Aaron Lu , Gerald Schaefer , "Kirill A. Shutemov" , Hugh Dickins , Ingo Molnar , Vegard Nossum , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, 20 Mar 2017, Huang, Ying wrote: > From: Huang Ying > > Now vzalloc() is used in swap code to allocate various data > structures, such as swap cache, swap slots cache, cluster info, etc. > Because the size may be too large on some system, so that normal > kzalloc() may fail. But using kzalloc() has some advantages, for > example, less memory fragmentation, less TLB pressure, etc. So change > the data structure allocation in swap code to use kvzalloc() which > will try kzalloc() firstly, and fallback to vzalloc() if kzalloc() > failed. > As questioned in -v1 of this patch, what is the benefit of directly compacting and reclaiming memory for high-order pages by first preferring kmalloc() if this does not require contiguous memory? -- 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