• Maninder Singh's avatar
    mm/page_owner: fix recursion bug after changing skip entries · 299815a4
    Maninder Singh authored
    This patch fixes commit 5f48f0bd ("mm, page_owner: skip unnecessary
    stack_trace entries").
    
    Because if we skip first two entries then logic of checking count value
    as 2 for recursion is broken and code will go in one depth recursion.
    
    so we need to check only one call of _RET_IP(__set_page_owner) while
    checking for recursion.
    
    Current Backtrace while checking for recursion:-
    
      (save_stack)             from (__set_page_owner)  // (But recursion returns true here)
      (__set_page_owner)       from (get_page_from_freelist)
      (get_page_from_freelist) from (__alloc_pages_nodemask)
      (__alloc_pages_nodemask) from (depot_save_stack)
      (depot_save_stack)       from (save_stack)       // recursion should return true here
      (save_stack)             from (__set_page_owner)
      (__set_page_owner)       from (get_page_from_freelist)
      (get_page_from_freelist) from (__alloc_pages_nodemask+)
      (__alloc_pages_nodemask) from (depot_save_stack)
      (depot_save_stack)       from (save_stack)
      (save_stack)             from (__set_page_owner)
      (__set_page_owner)       from (get_page_from_freelist)
    
    Correct Backtrace with fix:
    
      (save_stack)             from (__set_page_owner) // recursion returned true here
      (__set_page_owner)       from (get_page_from_freelist)
      (get_page_from_freelist) from (__alloc_pages_nodemask+)
      (__alloc_pages_nodemask) from (depot_save_stack)
      (depot_save_stack)       from (save_stack)
      (save_stack)             from (__set_page_owner)
      (__set_page_owner)       from (get_page_from_freelist)
    
    Link: http://lkml.kernel.org/r/1521607043-34670-1-git-send-email-maninder1.s@samsung.com
    Fixes: 5f48f0bd ("mm, page_owner: skip unnecessary stack_trace entries")
    Signed-off-by: default avatarManinder Singh <maninder1.s@samsung.com>
    Signed-off-by: default avatarVaneet Narang <v.narang@samsung.com>
    Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Oscar Salvador <osalvador@techadventures.net>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Ayush Mittal <ayush.m@samsung.com>
    Cc: Prakash Gupta <guptap@codeaurora.org>
    Cc: Vinayak Menon <vinmenon@codeaurora.org>
    Cc: Vasyl Gomonovych <gomonovych@gmail.com>
    Cc: Amit Sahrawat <a.sahrawat@samsung.com>
    Cc: <pankaj.m@samsung.com>
    Cc: Vaneet Narang <v.narang@samsung.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    299815a4
page_owner.c 15.1 KB