[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87a87tau1q.fsf@yhuang-dev.intel.com>
Date: Fri, 07 Apr 2017 09:24:49 +0800
From: "Huang\, Ying" <ying.huang@...el.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: "Huang\, Ying" <ying.huang@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...el.com>,
"Hugh Dickins" <hughd@...gle.com>, Shaohua Li <shli@...nel.org>,
Minchan Kim <minchan@...nel.org>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH -mm -v2] mm, swap: Use kvzalloc to allocate some swap data structure
Hi, Matthew,
Matthew Wilcox <willy@...radead.org> writes:
> On Wed, Apr 05, 2017 at 03:10:58PM +0800, Huang, Ying wrote:
>> In general, kmalloc() will have less memory fragmentation than
>> vmalloc(). From Dave Hansen: For example, 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.
>
> Wait, what? How does kmalloc() manage to allocate two pages that cross
> a 2MB boundary? AFAIK if you ask kmalloc to allocate N pages, it asks
> the page allocator for an order-log(N) page allocation. Being a buddy
> allocator, that comes back with an aligned set of pages. There's no
> way it can get the last page from a 2MB region and the first page from
> the next 2MB region.
OK. I will change the comments in the next version.
Best Regards,
Huang, Ying
Powered by blists - more mailing lists