Re: [PATCH 1/2] mm: disable LRU pagevec during the migration temporarily

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

 



Hi Minchan,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linux/master linus/master v5.12-rc1 next-20210303]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Minchan-Kim/mm-disable-LRU-pagevec-during-the-migration-temporarily/20210303-191809
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: nios2-randconfig-r032-20210303 (attached as .config)
compiler: nios2-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/6e669beb75caae92c613a012734b1a2dc9485524
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Minchan-Kim/mm-disable-LRU-pagevec-during-the-migration-temporarily/20210303-191809
        git checkout 6e669beb75caae92c613a012734b1a2dc9485524
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

   mm/swap.c:59:6: warning: no previous prototype for 'lru_cache_disabled' [-Wmissing-prototypes]
      59 | bool lru_cache_disabled(void)
         |      ^~~~~~~~~~~~~~~~~~
>> mm/swap.c:871:6: error: conflicting types for 'lru_add_drain_all'
     871 | void lru_add_drain_all(void)
         |      ^~~~~~~~~~~~~~~~~
   In file included from mm/swap.c:20:
   include/linux/swap.h:347:13: note: previous declaration of 'lru_add_drain_all' was here
     347 | extern void lru_add_drain_all(bool force_all_cpus);
         |             ^~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SERIAL_CORE_CONSOLE
   Depends on TTY && HAS_IOMEM
   Selected by
   - EARLY_PRINTK


vim +/lru_add_drain_all +871 mm/swap.c

053837fce7aa79 Nick Piggin           2006-01-18  768  
9852a7212324fd Michal Hocko          2018-01-31  769  /*
9852a7212324fd Michal Hocko          2018-01-31  770   * Doesn't need any cpu hotplug locking because we do rely on per-cpu
9852a7212324fd Michal Hocko          2018-01-31  771   * kworkers being shut down before our page_alloc_cpu_dead callback is
9852a7212324fd Michal Hocko          2018-01-31  772   * executed on the offlined cpu.
9852a7212324fd Michal Hocko          2018-01-31  773   * Calling this function with cpu hotplug locks held can actually lead
9852a7212324fd Michal Hocko          2018-01-31  774   * to obscure indirect dependencies via WQ context.
9852a7212324fd Michal Hocko          2018-01-31  775   */
6e669beb75caae Minchan Kim           2021-03-02  776  void lru_add_drain_all(bool force_all_cpus)
053837fce7aa79 Nick Piggin           2006-01-18  777  {
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  778  	/*
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  779  	 * lru_drain_gen - Global pages generation number
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  780  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  781  	 * (A) Definition: global lru_drain_gen = x implies that all generations
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  782  	 *     0 < n <= x are already *scheduled* for draining.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  783  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  784  	 * This is an optimization for the highly-contended use case where a
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  785  	 * user space workload keeps constantly generating a flow of pages for
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  786  	 * each CPU.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  787  	 */
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  788  	static unsigned int lru_drain_gen;
5fbc461636c32e Chris Metcalf         2013-09-12  789  	static struct cpumask has_work;
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  790  	static DEFINE_MUTEX(lock);
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  791  	unsigned cpu, this_gen;
5fbc461636c32e Chris Metcalf         2013-09-12  792  
ce612879ddc78e Michal Hocko          2017-04-07  793  	/*
ce612879ddc78e Michal Hocko          2017-04-07  794  	 * Make sure nobody triggers this path before mm_percpu_wq is fully
ce612879ddc78e Michal Hocko          2017-04-07  795  	 * initialized.
ce612879ddc78e Michal Hocko          2017-04-07  796  	 */
ce612879ddc78e Michal Hocko          2017-04-07  797  	if (WARN_ON(!mm_percpu_wq))
ce612879ddc78e Michal Hocko          2017-04-07  798  		return;
ce612879ddc78e Michal Hocko          2017-04-07  799  
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  800  	/*
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  801  	 * Guarantee pagevec counter stores visible by this CPU are visible to
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  802  	 * other CPUs before loading the current drain generation.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  803  	 */
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  804  	smp_mb();
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  805  
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  806  	/*
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  807  	 * (B) Locally cache global LRU draining generation number
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  808  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  809  	 * The read barrier ensures that the counter is loaded before the mutex
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  810  	 * is taken. It pairs with smp_mb() inside the mutex critical section
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  811  	 * at (D).
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  812  	 */
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  813  	this_gen = smp_load_acquire(&lru_drain_gen);
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  814  
5fbc461636c32e Chris Metcalf         2013-09-12  815  	mutex_lock(&lock);
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  816  
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  817  	/*
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  818  	 * (C) Exit the draining operation if a newer generation, from another
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  819  	 * lru_add_drain_all(), was already scheduled for draining. Check (A).
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  820  	 */
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  821  	if (unlikely(this_gen != lru_drain_gen))
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  822  		goto done;
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  823  
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  824  	/*
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  825  	 * (D) Increment global generation number
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  826  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  827  	 * Pairs with smp_load_acquire() at (B), outside of the critical
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  828  	 * section. Use a full memory barrier to guarantee that the new global
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  829  	 * drain generation number is stored before loading pagevec counters.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  830  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  831  	 * This pairing must be done here, before the for_each_online_cpu loop
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  832  	 * below which drains the page vectors.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  833  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  834  	 * Let x, y, and z represent some system CPU numbers, where x < y < z.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  835  	 * Assume CPU #z is is in the middle of the for_each_online_cpu loop
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  836  	 * below and has already reached CPU #y's per-cpu data. CPU #x comes
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  837  	 * along, adds some pages to its per-cpu vectors, then calls
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  838  	 * lru_add_drain_all().
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  839  	 *
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  840  	 * If the paired barrier is done at any later step, e.g. after the
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  841  	 * loop, CPU #x will just exit at (C) and miss flushing out all of its
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  842  	 * added pages.
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  843  	 */
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  844  	WRITE_ONCE(lru_drain_gen, lru_drain_gen + 1);
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  845  	smp_mb();
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  846  
5fbc461636c32e Chris Metcalf         2013-09-12  847  	cpumask_clear(&has_work);
5fbc461636c32e Chris Metcalf         2013-09-12  848  	for_each_online_cpu(cpu) {
5fbc461636c32e Chris Metcalf         2013-09-12  849  		struct work_struct *work = &per_cpu(lru_add_drain_work, cpu);
5fbc461636c32e Chris Metcalf         2013-09-12  850  
6e669beb75caae Minchan Kim           2021-03-02  851  		if (force_all_cpus ||
6e669beb75caae Minchan Kim           2021-03-02  852  		    pagevec_count(&per_cpu(lru_pvecs.lru_add, cpu)) ||
7e0cc01ea181c6 Qian Cai              2020-08-14  853  		    data_race(pagevec_count(&per_cpu(lru_rotate.pvec, cpu))) ||
b01b2141999936 Ingo Molnar           2020-05-27  854  		    pagevec_count(&per_cpu(lru_pvecs.lru_deactivate_file, cpu)) ||
b01b2141999936 Ingo Molnar           2020-05-27  855  		    pagevec_count(&per_cpu(lru_pvecs.lru_deactivate, cpu)) ||
b01b2141999936 Ingo Molnar           2020-05-27  856  		    pagevec_count(&per_cpu(lru_pvecs.lru_lazyfree, cpu)) ||
5fbc461636c32e Chris Metcalf         2013-09-12  857  		    need_activate_page_drain(cpu)) {
5fbc461636c32e Chris Metcalf         2013-09-12  858  			INIT_WORK(work, lru_add_drain_per_cpu);
ce612879ddc78e Michal Hocko          2017-04-07  859  			queue_work_on(cpu, mm_percpu_wq, work);
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  860  			__cpumask_set_cpu(cpu, &has_work);
5fbc461636c32e Chris Metcalf         2013-09-12  861  		}
5fbc461636c32e Chris Metcalf         2013-09-12  862  	}
5fbc461636c32e Chris Metcalf         2013-09-12  863  
5fbc461636c32e Chris Metcalf         2013-09-12  864  	for_each_cpu(cpu, &has_work)
5fbc461636c32e Chris Metcalf         2013-09-12  865  		flush_work(&per_cpu(lru_add_drain_work, cpu));
5fbc461636c32e Chris Metcalf         2013-09-12  866  
eef1a429f234f8 Konstantin Khlebnikov 2019-11-30  867  done:
5fbc461636c32e Chris Metcalf         2013-09-12  868  	mutex_unlock(&lock);
053837fce7aa79 Nick Piggin           2006-01-18  869  }
6ea183d60c4695 Michal Hocko          2019-02-20  870  #else
6ea183d60c4695 Michal Hocko          2019-02-20 @871  void lru_add_drain_all(void)
6ea183d60c4695 Michal Hocko          2019-02-20  872  {
6ea183d60c4695 Michal Hocko          2019-02-20  873  	lru_add_drain();
6ea183d60c4695 Michal Hocko          2019-02-20  874  }
6446a5131e24a8 Ahmed S. Darwish      2020-08-27  875  #endif /* CONFIG_SMP */
053837fce7aa79 Nick Piggin           2006-01-18  876  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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