• Laura Abbott's avatar
    mm/page_alloc.c: call kernel_map_pages in unset_migrateype_isolate · a38edfb2
    Laura Abbott authored
    [ Upstream commit cfa86943 ]
    
    Commit 3c605096 ("mm/page_alloc: restrict max order of merging on
    isolated pageblock") changed the logic of unset_migratetype_isolate to
    check the buddy allocator and explicitly call __free_pages to merge.
    
    The page that is being freed in this path never had prep_new_page called
    so set_page_refcounted is called explicitly but there is no call to
    kernel_map_pages.  With the default kernel_map_pages this is mostly
    harmless but if kernel_map_pages does any manipulation of the page
    tables (unmapping or setting pages to read only) this may trigger a
    fault:
    
        alloc_contig_range test_pages_isolated(ceb00, ced00) failed
        Unable to handle kernel paging request at virtual address ffffffc0cec00000
        pgd = ffffffc045fc4000
        [ffffffc0cec00000] *pgd=0000000000000000
        Internal error: Oops: 9600004f [#1] PREEMPT SMP
        Modules linked in: exfatfs
        CPU: 1 PID: 23237 Comm: TimedEventQueue Not tainted 3.10.49-gc72ad36-dirty #1
        task: ffffffc03de52100 ti: ffffffc015388000 task.ti: ffffffc015388000
        PC is at memset+0xc8/0x1c0
        LR is at kernel_map_pages+0x1ec/0x244
    
    Fix this by calling kernel_map_pages to ensure the page is set in the
    page table properly
    
    Fixes: 3c605096 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
    Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Acked-by: default avatarRik van Riel <riel@redhat.com>
    Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
    Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
    Cc: Xishi Qiu <qiuxishi@huawei.com>
    Cc: Vladimir Davydov <vdavydov@parallels.com>
    Acked-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Gioh Kim <gioh.kim@lge.com>
    Cc: Michal Nazarewicz <mina86@mina86.com>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    a38edfb2
page_isolation.c 8.69 KB