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?