lkml.org 
[lkml]   [2016]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages
    Date
    Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
    happen as ZONE_DEVICE page must always have an elevated refcount.

    This is to catch refcounting issues in a sane way for ZONE_DEVICE pages.

    Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
    ---
    mm/page_alloc.c | 10 ++++++++++
    1 file changed, 10 insertions(+)

    diff --git a/mm/page_alloc.c b/mm/page_alloc.c
    index 0fbfead..09b2630 100644
    --- a/mm/page_alloc.c
    +++ b/mm/page_alloc.c
    @@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold)
    unsigned long pfn = page_to_pfn(page);
    int migratetype;

    + /*
    + * This should never happen ! Page from ZONE_DEVICE always must have an
    + * active refcount. Complain about it and try to restore the refcount.
    + */
    + if (is_zone_device_page(page)) {
    + VM_BUG_ON_PAGE(is_zone_device_page(page), page);
    + page_ref_inc(page);
    + return;
    + }
    +
    if (!free_pcp_prepare(page))
    return;

    --
    2.4.3
    \
     
     \ /
      Last update: 2016-11-18 18:18    [W:3.464 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site