Re: [PATCH v2 1/6] mm: Handle page->mapping better in dump_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-07-10 18:30, John Hubbard wrote:
On 2020-07-09 13:21, Matthew Wilcox (Oracle) wrote:
If we can't call page_mapping() to get the page mapping, handle the
anon/ksm/movable bits correctly.

Hi Matthew,

I see why you did this, as otherwise the new printing won't work.

Oh, and I forget to add: my only comment was just a documentation
suggestion, not critical at all, and so:

    Reviewed-by: John Hubbard <jhubbard@xxxxxxxxxx>

thanks,
--
John Hubbard
NVIDIA


Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
  mm/debug.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/debug.c b/mm/debug.c
index 4f376514744d..e5de63406b59 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -70,7 +70,12 @@ void __dump_page(struct page *page, const char *reason)
      if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
          /* Corrupt page, cannot call page_mapping */

It's tricky to step lightly through the debris of corrupted page
pointer here, but how about this updated comment, to replace the one-liner
above:

         /*
          * Corrupt page, so we cannot call page_mapping. Instead, do a
          * safe subset of the steps that page_mapping() does. Caution:
          * this will be misleading for tail pages, PageSwapCache pages,
          * and potentially other situations. (See the page_mapping()
          * implementation for what's missing here.)
          */


-        mapping = page->mapping;
+        unsigned long tmp = (unsigned long)page->mapping;
+
+        if (tmp & PAGE_MAPPING_ANON)
+            mapping = NULL;
+        else
+            mapping = (void *)(tmp & ~PAGE_MAPPING_FLAGS);
          head = page;
          compound = false;
      } else {








[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux