On Wed, 31 May 2017 14:31:16 +0800 kernel test robot <xiaolong...@intel.com> 
wrote:

> 
> FYI, we noticed the following commit:
> 
> commit: aefd950b83d2d8cf4d3c270546c8725f866da191 ("mm: make kswapd try harder 
> to keep active pages in cache")
> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
> 
> in testcase: boot
> 
> ...
>
> [  160.541829] divide error: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
>
> ...
>
> [  160.587334] RIP: shrink_node+0x47f/0x5a0 RSP: ffffc900001bbd78
>
> ...


hm.  This?

--- a/mm/vmscan.c~mm-make-kswapd-try-harder-to-keep-active-pages-in-cache-fix-2
+++ a/mm/vmscan.c
@@ -2724,7 +2724,7 @@ static bool shrink_node(pg_data_t *pgdat
                if (sc->nr_reclaimed - nr_reclaimed) {
                        reclaimable = true;
                } else if (sc->inactive_only && !skip_slab) {
-                       unsigned long percent;
+                       unsigned long percent = 100;
 
                        /*
                         * We didn't reclaim anything this go around, so the
@@ -2735,7 +2735,8 @@ static bool shrink_node(pg_data_t *pgdat
                         * hoping that eventually we'll start freeing enough
                         * objects to reclaim space.
                         */
-                       percent = (slab_reclaimed * 100 / slab_scanned);
+                       if (slab_scanned)
+                               percent = (slab_reclaimed * 100 / slab_scanned);
                        if (percent < 50)
                                sc->inactive_only = 0;
                        else

Or this?

--- a/mm/vmscan.c~mm-make-kswapd-try-harder-to-keep-active-pages-in-cache-fix-3
+++ a/mm/vmscan.c
@@ -2628,7 +2628,7 @@ static bool shrink_node(pg_data_t *pgdat
                };
                unsigned long node_lru_pages = 0;
                unsigned long slab_reclaimed = 0;
-               unsigned long slab_scanned = 0;
+               unsigned long slab_scanned = 1;         /* Avoid div-by-zero */
                struct mem_cgroup *memcg;
 
                nr_reclaimed = sc->nr_reclaimed;
_

Reply via email to