From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752839AbdCXN5N (ORCPT ); Fri, 24 Mar 2017 09:57:13 -0400 Received: from mga11.intel.com ([192.55.52.93]:37652 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbdCXN5F (ORCPT ); Fri, 24 Mar 2017 09:57:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,215,1486454400"; d="scan'208";a="80632009" Subject: Re: [PATCH -v2 1/2] mm, swap: Use kvzalloc to allocate some swap data structure To: John Hubbard , "Huang, Ying" References: <20170320084732.3375-1-ying.huang@intel.com> <8737e3z992.fsf@yhuang-dev.intel.com> <87poh7xoms.fsf@yhuang-dev.intel.com> <2d55e06d-a0b6-771a-bba0-f9517d422789@nvidia.com> <87d1d7uoti.fsf@yhuang-dev.intel.com> <624b8e59-34e5-3538-0a93-d33d9e4ac555@nvidia.com> Cc: David Rientjes , Andrew Morton , Andi Kleen , 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 From: Dave Hansen Message-ID: Date: Fri, 24 Mar 2017 06:56:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <624b8e59-34e5-3538-0a93-d33d9e4ac555@nvidia.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/24/2017 12:33 AM, John Hubbard wrote: > There might be some additional information you are using to come up with > that conclusion, that is not obvious to me. Any thoughts there? These > calls use the same underlying page allocator (and I thought that both > were subject to the same constraints on defragmentation, as a result of > that). So I am not seeing any way that kmalloc could possibly be a > less-fragmenting call than vmalloc. You guys are having quite a discussion over a very small point. But, Ying is right. Let's say we have a two-page data structure. vmalloc() takes two effectively random order-0 pages, probably from two different 2M pages and pins them. That "kills" two 2M pages. kmalloc(), allocating two *contiguous* pages, is very unlikely to cross a 2M boundary (it theoretically could). That means it will only "kill" the possibility of a single 2M page. More 2M pages == less fragmentation. 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 496826B0333 for ; Fri, 24 Mar 2017 09:56:16 -0400 (EDT) Received: by mail-pg0-f72.google.com with SMTP id u202so476616pgb.9 for ; Fri, 24 Mar 2017 06:56:16 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com. [134.134.136.65]) by mx.google.com with ESMTPS id s9si2964916pgo.309.2017.03.24.06.56.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2017 06:56:15 -0700 (PDT) Subject: Re: [PATCH -v2 1/2] mm, swap: Use kvzalloc to allocate some swap data structure References: <20170320084732.3375-1-ying.huang@intel.com> <8737e3z992.fsf@yhuang-dev.intel.com> <87poh7xoms.fsf@yhuang-dev.intel.com> <2d55e06d-a0b6-771a-bba0-f9517d422789@nvidia.com> <87d1d7uoti.fsf@yhuang-dev.intel.com> <624b8e59-34e5-3538-0a93-d33d9e4ac555@nvidia.com> From: Dave Hansen Message-ID: Date: Fri, 24 Mar 2017 06:56:10 -0700 MIME-Version: 1.0 In-Reply-To: <624b8e59-34e5-3538-0a93-d33d9e4ac555@nvidia.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: John Hubbard , "Huang, Ying" Cc: David Rientjes , Andrew Morton , Andi Kleen , 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 03/24/2017 12:33 AM, John Hubbard wrote: > There might be some additional information you are using to come up with > that conclusion, that is not obvious to me. Any thoughts there? These > calls use the same underlying page allocator (and I thought that both > were subject to the same constraints on defragmentation, as a result of > that). So I am not seeing any way that kmalloc could possibly be a > less-fragmenting call than vmalloc. You guys are having quite a discussion over a very small point. But, Ying is right. Let's say we have a two-page data structure. vmalloc() takes two effectively random order-0 pages, probably from two different 2M pages and pins them. That "kills" two 2M pages. kmalloc(), allocating two *contiguous* pages, is very unlikely to cross a 2M boundary (it theoretically could). That means it will only "kill" the possibility of a single 2M page. More 2M pages == less fragmentation. -- 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