Re: 2.4.10 still slow compared to 2.4.5pre1

Andrea Arcangeli (andrea@suse.de)
Wed, 26 Sep 2001 03:58:10 +0200


On Tue, Sep 25, 2001 at 08:44:35PM -0400, DICKENS,CARY (HP-Loveland,ex2) wrote:
> Andrea,
>
> I hate to inform you that we tracked this down and nr_inactive_pages can be
> zero. This causes divide by zero in shrink_caches.
>
> This is from the 00_vm-tweaks-1 patch:
> static int shrink_caches(int priority, zone_t * classzone, unsigned int
> gfp_mask, int nr_pages)
> {
> - int max_scan = nr_inactive_pages / priority;
> + int max_scan;
> + int chunk_size = nr_pages;
> + unsigned long ratio;
>
> nr_pages -= kmem_cache_reap(gfp_mask);
> if (nr_pages <= 0)
> return 0;
>
> - /* Do we want to age the active list? */
> - if (nr_inactive_pages < nr_active_pages*2)
> - refill_inactive(nr_pages);
> + spin_lock(&pagemap_lru_lock);
> + nr_pages = chunk_size;
> + /* try to keep the active list 2/3 of the size of the cache */
> + ratio = (unsigned long) nr_pages * nr_active_pages /
> (nr_inactive_pages * 2);

how can you ever trigger it during boot?

anyways that is a real bug, thanks for spotting it, you can just add 1
to nr_inactive_pages to fix it.

ratio = (unsigned long) nr_pages * nr_active_pages / ((nr_inactive_pages+1) * 2);

it will be fixed in the next update of course.

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/