Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1594591

Re: [PATCH v2 2/2] mm, page_alloc: avoid page_to_pfn() when merging buddies

From Tony Luck <tony.luck@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/2] mm, page_alloc: avoid page_to_pfn() when merging buddies
Date 2017-03-07 20:50 +0100
Message-ID <titho-3Jt-25@gated-at.bofh.it> (permalink)
References <sOZuO-3pa-13@gated-at.bofh.it> <sOZuO-3pa-11@gated-at.bofh.it> <tisv0-3b1-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Mar 7, 2017 at 10:40 AM, Tony Luck <tony.luck@gmail.com> wrote:
> The commit messages talks about the "only caller" of page_is_buddy().
> But grep shows two call sites:
>
> mm/page_alloc.c:816:            if (!page_is_buddy(page, buddy, order))
> mm/page_alloc.c:876:            if (page_is_buddy(higher_page,

and it looks like the second one is the problem:

        if ((order < MAX_ORDER-2) && pfn_valid_within(buddy_pfn)) {
                struct page *higher_page, *higher_buddy;
                combined_pfn = buddy_pfn & pfn;
                higher_page = page + (combined_pfn - pfn);
                buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1);
                higher_buddy = higher_page + (buddy_pfn - combined_pfn);
                if (page_is_buddy(higher_page, higher_buddy, order + 1)) {
                        list_add_tail(&page->lru,
                                &zone->free_area[order].free_list[migratetype]);
                        goto out;
                }
        }

Although outer "if" checked for pfn_valid_within(buddy_pfn),
we actually pass "higher_buddy" to this call of page_is_buddy().

-Tony

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/2] mm, page_alloc: avoid page_to_pfn() when merging buddies Tony Luck <tony.luck@gmail.com> - 2017-03-07 20:00 +0100
  Re: [PATCH v2 2/2] mm, page_alloc: avoid page_to_pfn() when merging buddies Tony Luck <tony.luck@gmail.com> - 2017-03-07 20:50 +0100

csiph-web