linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: David Hildenbrand <david@redhat.com>, Qian Cai <cai@lca.pw>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Oscar Salvador <osalvador@suse.de>,
	Mel Gorman <mgorman@techsingularity.net>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Pavel Tatashin <pavel.tatashin@microsoft.com>,
	linux-kernel@vger.kernel.org,
	Ralph Campbell <rcampbell@nvidia.com>
Subject: Re: [PATCH] mm/page_alloc: Add a reason for reserved pages in has_unmovable_pages()
Date: Tue, 14 Jan 2020 10:10:13 +0100	[thread overview]
Message-ID: <20200114091013.GD19428@dhcp22.suse.cz> (raw)
In-Reply-To: <f6487dc1-c962-67aa-131e-2eec4f6ca686@arm.com>

[Cc Ralph]

On Tue 14-01-20 13:49:14, Anshuman Khandual wrote:
> 
> 
> On 10/04/2019 01:55 PM, David Hildenbrand wrote:
> > On 03.10.19 14:14, Qian Cai wrote:
> >>
> >>
> >>> On Oct 3, 2019, at 8:01 AM, Anshuman Khandual <Anshuman.Khandual@arm.com> wrote:
> >>>
> >>> Will something like this be better ?
> >>
> >> Not really. dump_page() will dump PageCompound information anyway, so it is trivial to figure out if went in that path.
> >>
> > 
> > I agree, I use the dump_page() output frequently to identify PG_reserved
> > pages. No need to duplicate that.
> 
> Here in this path there is a reserved page which is preventing
> offlining a memory section but unfortunately dump_page() does
> not print page->flags for a reserved page pinned there possibly
> through memblock_reserve() during boot.
> 
> __offline_pages()
> 	start_isolate_page_range()
> 		set_migratetype_isolate()
> 			has_unmovable_pages()
> 				dump_page() 
> 
> [   64.920970] ------------[ cut here ]------------
> [   64.921718] WARNING: CPU: 16 PID: 1116 at mm/page_alloc.c:8298 has_unmovable_pages+0x274/0x2a8
> [   64.923110] Modules linked in:
> [   64.923634] CPU: 16 PID: 1116 Comm: bash Not tainted 5.5.0-rc6-00006-gca544f2a11ae-dirty #281
> [   64.925102] Hardware name: linux,dummy-virt (DT)
> [   64.925905] pstate: 60400085 (nZCv daIf +PAN -UAO)
> [   64.926742] pc : has_unmovable_pages+0x274/0x2a8
> [   64.927554] lr : has_unmovable_pages+0x298/0x2a8
> [   64.928359] sp : ffff800014fd3a00
> [   64.928944] x29: ffff800014fd3a00 x28: fffffe0017640000 
> [   64.929875] x27: 0000000000000000 x26: ffff0005fcfcda00 
> [   64.930810] x25: 0000000000640000 x24: 0000000000000003 
> [   64.931736] x23: 0000000019840000 x22: 0000000000001380 
> [   64.932667] x21: ffff800011259000 x20: ffff0005fcfcda00 
> [   64.933588] x19: 0000000000661000 x18: 0000000000000010 
> [   64.934514] x17: 0000000000000000 x16: 0000000000000000 
> [   64.935454] x15: ffffffffffffffff x14: ffff8000118498c8 
> [   64.936377] x13: ffff800094fd3797 x12: ffff800014fd379f 
> [   64.937304] x11: ffff800011861000 x10: ffff800014fd3720 
> [   64.938226] x9 : 00000000ffffffd0 x8 : ffff8000106a60d0 
> [   64.939156] x7 : 0000000000000000 x6 : ffff0005fc6261b0 
> [   64.940078] x5 : ffff0005fc6261b0 x4 : 0000000000000000 
> [   64.941003] x3 : ffff0005fc62cf80 x2 : ffffffffffffec80 
> [   64.941927] x1 : ffff800011141b58 x0 : ffff0005fcfcda00 
> [   64.942857] Call trace:
> [   64.943298]  has_unmovable_pages+0x274/0x2a8
> [   64.944056]  start_isolate_page_range+0x258/0x360
> [   64.944879]  __offline_pages+0xf4/0x9e8
> [   64.945554]  offline_pages+0x10/0x18
> [   64.946189]  memory_block_action+0x40/0x1a0
> [   64.946929]  memory_subsys_offline+0x4c/0x78
> [   64.947679]  device_offline+0x98/0xc8
> [   64.948328]  unprobe_store+0xa8/0x158
> [   64.948976]  dev_attr_store+0x14/0x28
> [   64.949628]  sysfs_kf_write+0x40/0x50
> [   64.950273]  kernfs_fop_write+0x108/0x218
> [   64.950983]  __vfs_write+0x18/0x40
> [   64.951592]  vfs_write+0xb0/0x1d0
> [   64.952175]  ksys_write+0x64/0xe8
> [   64.952761]  __arm64_sys_write+0x18/0x20
> [   64.953451]  el0_svc_common.constprop.2+0x88/0x150
> [   64.954293]  el0_svc_handler+0x20/0x80
> [   64.954963]  el0_sync_handler+0x118/0x188
> [   64.955669]  el0_sync+0x140/0x180
> [   64.956256] ---[ end trace b162b4d1cbea304d ]---
> [   64.957063] page:fffffe0017640000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
> [   64.958489] raw: 1ffff80000001000 fffffe0017640008 fffffe0017640008 0000000000000000
> [   64.959839] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
> [   64.961174] page dumped because: unmovable page
> 
> The reason is dump_page() does not print page->flags universally
> and only does so for KSM, Anon and File pages while excluding
> reserved pages at boot. Wondering should not we make printing
> page->flags universal ?

We used to do that and this caught me as a surprise when looking again.
This is a result of 76a1850e4572 ("mm/debug.c: __dump_page() prints an
extra line") which is a cleanup patch and I suspect this result was not
anticipated.

The following will do the trick but I cannot really say I like the code
duplication. pr_cont in this case sounds like a much cleaner solution to
me.

diff --git a/mm/debug.c b/mm/debug.c
index 0461df1207cb..4cbf30d03c88 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -89,6 +89,8 @@ void __dump_page(struct page *page, const char *reason)
 		} else
 			pr_warn("%ps\n", mapping->a_ops);
 		pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
+	} else {
+		pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
 	}
 	BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
 

-- 
Michal Hocko
SUSE Labs


  parent reply	other threads:[~2020-01-14  9:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03  8:10 [PATCH] mm/page_alloc: Add a reason for reserved pages in has_unmovable_pages() Anshuman Khandual
2019-10-03  9:05 ` Qian Cai
2019-10-03  9:32   ` Anshuman Khandual
2019-10-03  9:53     ` Anshuman Khandual
2019-10-03 11:19     ` Qian Cai
2019-10-03 11:32       ` Anshuman Khandual
2019-10-03 11:50         ` Qian Cai
2019-10-03 12:02           ` Anshuman Khandual
2019-10-03 12:14             ` Qian Cai
2019-10-04  8:25               ` David Hildenbrand
2020-01-14  8:19                 ` Anshuman Khandual
2020-01-14  8:30                   ` David Hildenbrand
2020-01-14  9:10                   ` Michal Hocko [this message]
2020-01-14 10:23                     ` Vlastimil Babka
2020-01-14 11:03                       ` Anshuman Khandual
2020-01-14 11:32                       ` Michal Hocko
2020-01-14 12:04                         ` [PATCH] mm, debug: always print flags in dump_page() Vlastimil Babka
2020-01-14 13:35                           ` Michal Hocko
2020-01-14 18:22                         ` [PATCH] mm/page_alloc: Add a reason for reserved pages in has_unmovable_pages() Ralph Campbell
2019-10-04 10:58 ` Michal Hocko
2019-10-04 11:44   ` Anshuman Khandual
2019-10-04 12:56     ` Qian Cai
2019-10-04 13:07       ` Michal Hocko
2019-10-04 13:30         ` Qian Cai
2019-10-04 13:38           ` Michal Hocko
2019-10-04 13:56             ` Qian Cai
2019-10-04 14:41               ` Michal Hocko
2019-10-05 21:22                 ` Andrew Morton
2019-10-05 22:38                   ` Qian Cai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200114091013.GD19428@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --cc=rcampbell@nvidia.com \
    --cc=rppt@linux.ibm.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).