From: David Hildenbrand <david@redhat.com>
To: Qian Cai <cai@lca.pw>, akpm@linux-foundation.org
Cc: mhocko@kernel.org, sergey.senozhatsky.work@gmail.com,
pmladek@suse.com, rostedt@goodmis.org, peterz@infradead.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] mm/hotplug: silence a lockdep splat with printk()
Date: Tue, 14 Jan 2020 21:20:08 +0100 [thread overview]
Message-ID: <6d9d2923-a44c-60fb-5caa-e6228cb8aaf5@redhat.com> (raw)
In-Reply-To: <20200114201114.14696-1-cai@lca.pw>
On 14.01.20 21:11, Qian Cai wrote:
> Similar to the recent commit [1] merged into the random and -next trees,
> it is not a good idea to call printk() with zone->lock held. The
> standard fix is to use printk_deferred() in those places, but memory
> offline will call dump_page() which need to defer after the lock. While
> at it, remove a similar but unnecessary debug printk() as well.
>
> [1] https://lore.kernel.org/lkml/1573679785-21068-1-git-send-email-cai@lca.pw/
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
> include/linux/page-isolation.h | 2 +-
> mm/memory_hotplug.c | 2 +-
> mm/page_alloc.c | 12 +++++-------
> mm/page_isolation.c | 10 +++++++++-
> 4 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index 148e65a9c606..5d8ba078006f 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -34,7 +34,7 @@ static inline bool is_migrate_isolate(int migratetype)
> #define REPORT_FAILURE 0x2
>
> bool has_unmovable_pages(struct zone *zone, struct page *page, int migratetype,
> - int flags);
> + int flags, char *dump);
> void set_pageblock_migratetype(struct page *page, int migratetype);
> int move_freepages_block(struct zone *zone, struct page *page,
> int migratetype, int *num_movable);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 7a6de9b0dcab..f10928538fa3 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1149,7 +1149,7 @@ static bool is_pageblock_removable_nolock(unsigned long pfn)
> return false;
>
> return !has_unmovable_pages(zone, page, MIGRATE_MOVABLE,
> - MEMORY_OFFLINE);
> + MEMORY_OFFLINE, NULL);
> }
>
> /* Checks if this range of memory is likely to be hot-removable. */
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e56cd1f33242..b6bec3925e80 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -8204,7 +8204,7 @@ void *__init alloc_large_system_hash(const char *tablename,
> * race condition. So you can't expect this function should be exact.
> */
> bool has_unmovable_pages(struct zone *zone, struct page *page, int migratetype,
> - int flags)
> + int flags, char *dump)
> {
> unsigned long iter = 0;
> unsigned long pfn = page_to_pfn(page);
> @@ -8305,8 +8305,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int migratetype,
> return false;
> unmovable:
> WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);
> - if (flags & REPORT_FAILURE)
> - dump_page(pfn_to_page(pfn + iter), reason);
> + if (flags & REPORT_FAILURE) {
> + page = pfn_to_page(pfn + iter);
> + strscpy(dump, reason, 64);
> + }
> return true;
> }
>
> @@ -8711,10 +8713,6 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
> BUG_ON(!PageBuddy(page));
> order = page_order(page);
> offlined_pages += 1 << order;
> -#ifdef CONFIG_DEBUG_VM
> - pr_info("remove from free list %lx %d %lx\n",
> - pfn, 1 << order, end_pfn);
> -#endif
ack to getting rid of this.
Regarding the other stuff, I remember Michal had an opinion about the
previous approach, so it's best if he comments.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-01-14 20:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 20:11 [PATCH -next] mm/hotplug: silence a lockdep splat with printk() Qian Cai
2020-01-14 20:20 ` David Hildenbrand [this message]
2020-01-14 21:02 ` Michal Hocko
2020-01-14 21:40 ` Qian Cai
2020-01-14 23:53 ` Andrew Morton
2020-01-15 1:02 ` Qian Cai
2020-01-15 1:19 ` Andrew Morton
2020-01-15 1:38 ` Qian Cai
2020-01-15 8:37 ` Michal Hocko
2020-01-15 9:52 ` Petr Mladek
2020-01-15 11:49 ` Qian Cai
2020-01-15 17:02 ` Petr Mladek
2020-01-15 17:16 ` Qian Cai
2020-01-16 14:29 ` Petr Mladek
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=6d9d2923-a44c-60fb-5caa-e6228cb8aaf5@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
/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).