linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Rong Chen <rong.a.chen@intel.com>
Cc: kernel test robot <lkp@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	kbuild-all@01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	John Dias <joaodias@google.com>, Michal Hocko <mhocko@suse.com>,
	David Hildenbrand <david@redhat.com>,
	Jason Baron <jbaron@akamai.com>
Subject: Re: [kbuild-all] Re: [PATCH v2] mm: page_alloc: dump migrate-failed pages
Date: Mon, 8 Mar 2021 18:23:17 -0800	[thread overview]
Message-ID: <YEbcFc0up0NFnSjY@google.com> (raw)
In-Reply-To: <d994f666-7883-25a3-9d46-ca431874dc18@intel.com>

On Tue, Mar 09, 2021 at 08:41:44AM +0800, Rong Chen wrote:
> 
> 
> On 3/9/21 6:29 AM, Minchan Kim wrote:
> > On Tue, Mar 09, 2021 at 05:29:30AM +0800, kernel test robot wrote:
> > > Hi Minchan,
> > > 
> > > I love your patch! Perhaps something to improve:
> > > 
> > > [auto build test WARNING on hnaz-linux-mm/master]
> > > 
> > > url:    https://github.com/0day-ci/linux/commits/Minchan-Kim/mm-page_alloc-dump-migrate-failed-pages/20210309-042205
> > > base:   https://github.com/hnaz/linux-mm master
> > > config: m68k-allmodconfig (attached as .config)
> > > compiler: m68k-linux-gcc (GCC) 9.3.0
> > > reproduce (this is a W=1 build):
> > >          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >          chmod +x ~/bin/make.cross
> > >          # https://github.com/0day-ci/linux/commit/3c635af37b862e9c601ee8d5818f7da9cd3e2e57
> > >          git remote add linux-review https://github.com/0day-ci/linux
> > >          git fetch --no-tags linux-review Minchan-Kim/mm-page_alloc-dump-migrate-failed-pages/20210309-042205
> > >          git checkout 3c635af37b862e9c601ee8d5818f7da9cd3e2e57
> > >          # save the attached .config to linux build tree
> > >          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > 
> > > All warnings (new ones prefixed by >>):
> > > 
> > >     arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
> > >       169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
> > >           |                                                 ^~
> > >     include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > >        78 | # define unlikely(x) __builtin_expect(!!(x), 0)
> > >           |                                          ^
> > >     include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
> > >       143 |  BUG_ON(!virt_addr_valid(buf));
> > >           |  ^~~~~~
> > >     include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
> > >       143 |  BUG_ON(!virt_addr_valid(buf));
> > >           |          ^~~~~~~~~~~~~~~
> > >     In file included from arch/m68k/include/asm/page.h:60,
> > >                      from arch/m68k/include/asm/thread_info.h:6,
> > >                      from include/linux/thread_info.h:38,
> > >                      from include/asm-generic/preempt.h:5,
> > >                      from ./arch/m68k/include/generated/asm/preempt.h:1,
> > >                      from include/linux/preempt.h:78,
> > >                      from include/linux/spinlock.h:51,
> > >                      from include/linux/mmzone.h:8,
> > >                      from include/linux/gfp.h:6,
> > >                      from include/linux/mm.h:10,
> > >                      from mm/page_alloc.c:19:
> > I am not sure this is triggered by the patch since I could see the
> > warn with reverting the patch.
> 
> Hi Minchan,
> 
> Only the lines prefixed by ">>" are related with the patch:
> 
> > > mm/page_alloc.c:8348:5: warning: no previous prototype for 'alloc_contig_ratelimit' [-Wmissing-prototypes]
> 
>     8348 | int alloc_contig_ratelimit(void)
>          |     ^~~~~~~~~~~~~~~~~~~~~~
> 
> > > mm/page_alloc.c:8353:6: warning: no previous prototype for 'dump_migrate_failure_pages' [-Wmissing-prototypes]
> 
>     8353 | void dump_migrate_failure_pages(struct list_head *page_list)
> 

Thanks for the clarification.

Then, below should fix the warning.
I will respin it at next revision once I get more feedback.

+#if defined(CONFIG_DYNAMIC_DEBUG) || \
+       (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
+static void dump_migrate_failure_pages(struct list_head *page_list)
+{
+       static DEFINE_RATELIMIT_STATE(_rs,
+                                       DEFAULT_RATELIMIT_INTERVAL,
+                                       DEFAULT_RATELIMIT_BURST);
+
+       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor,
+                       "migrate failure");
+       if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) {
+               struct page *page;
+
+               WARN(1, "failed callstack");
+               list_for_each_entry(page, page_list, lru)
+                       dump_page(page, "migration failure");
+       }
+}
+#else
+static inline void dump_migrate_failure_pages(struct list_head *page_list)
+{
+}
+#endif
+
 /* [start, end) must belong to a single zone. */
 static int __alloc_contig_migrate_range(struct compact_control *cc,
                                        unsigned long start, unsigned long end)
@@ -8496,6 +8520,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
                                NULL, (unsigned long)&mtc, cc->mode, MR_CONTIG_RANGE);
        }
        if (ret < 0) {
+               dump_migrate_failure_pages(&cc->migratepages);
                putback_movable_pages(&cc->migratepages);
                return ret;
        }


  reply	other threads:[~2021-03-09  2:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 20:20 [PATCH v2] mm: page_alloc: dump migrate-failed pages Minchan Kim
2021-03-08 21:29 ` kernel test robot
2021-03-08 22:29   ` Minchan Kim
2021-03-09  0:41     ` [kbuild-all] " Rong Chen
2021-03-09  2:23       ` Minchan Kim [this message]
2021-03-09  0:21 ` Andrew Morton
2021-03-09  2:21   ` Minchan Kim
2021-03-09  0:30 ` kernel test robot
2021-03-09  0:30 ` [RFC PATCH] mm: page_alloc: alloc_contig_ratelimit() can be static kernel test robot
2021-03-09  9:32 ` [PATCH v2] mm: page_alloc: dump migrate-failed pages Michal Hocko
2021-03-09 16:15   ` Minchan Kim
2021-03-09 16:32     ` Michal Hocko
2021-03-09 17:27       ` Minchan Kim
2021-03-10 13:04         ` Michal Hocko
2021-03-10 15:59           ` Minchan Kim
2021-03-10  7:42     ` Minchan Kim
2021-03-10  8:20       ` David Hildenbrand
2021-03-10 15:45         ` Minchan Kim
2021-03-10 13:07       ` Michal Hocko
2021-03-10 16:05         ` Minchan Kim
2021-03-10 16:46           ` Michal Hocko
2021-03-10 17:06             ` Minchan Kim
2021-03-10 18:07               ` Minchan Kim
2021-03-10 13:26   ` Matthew Wilcox
2021-03-10 13:54     ` Michal Hocko

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=YEbcFc0up0NFnSjY@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jbaron@akamai.com \
    --cc=joaodias@google.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mhocko@suse.com \
    --cc=rong.a.chen@intel.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).