From: "Huang\, Ying" <ying.huang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Huang, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Dave Hansen <dave.hansen@intel.com>,
Hugh Dickins <hughd@google.com>, Shaohua Li <shli@kernel.org>,
Minchan Kim <minchan@kernel.org>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH -mm -v2] mm, swap: Use kvzalloc to allocate some swap data structure
Date: Fri, 07 Apr 2017 09:24:49 +0800 [thread overview]
Message-ID: <87a87tau1q.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <20170406134024.GD31725@bombadil.infradead.org> (Matthew Wilcox's message of "Thu, 6 Apr 2017 06:40:24 -0700")
Hi, Matthew,
Matthew Wilcox <willy@infradead.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
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Huang\, Ying" <ying.huang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Huang\, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>,
Dave Hansen <dave.hansen@intel.com>,
"Hugh Dickins" <hughd@google.com>, Shaohua Li <shli@kernel.org>,
Minchan Kim <minchan@kernel.org>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH -mm -v2] mm, swap: Use kvzalloc to allocate some swap data structure
Date: Fri, 07 Apr 2017 09:24:49 +0800 [thread overview]
Message-ID: <87a87tau1q.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <20170406134024.GD31725@bombadil.infradead.org> (Matthew Wilcox's message of "Thu, 6 Apr 2017 06:40:24 -0700")
Hi, Matthew,
Matthew Wilcox <willy@infradead.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
next prev parent reply other threads:[~2017-04-07 1:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 7:10 [PATCH -mm -v2] mm, swap: Use kvzalloc to allocate some swap data structure Huang, Ying
2017-04-05 7:10 ` Huang, Ying
2017-04-06 13:40 ` Matthew Wilcox
2017-04-06 13:40 ` Matthew Wilcox
2017-04-07 1:24 ` Huang, Ying [this message]
2017-04-07 1:24 ` Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a87tau1q.fsf@yhuang-dev.intel.com \
--to=ying.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=shli@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.