Re: [patch] sched: fix scheduling latencies for !PREEMPT kernels

Nick Piggin
2004-09-14T12:58:40Z

Ingo Molnar wrote:

> --- linux/mm/vmscan.c.orig
> +++ linux/mm/vmscan.c
> @@ -361,6 +361,8 @@ static int shrink_list(struct list_head
> int may_enter_fs;
> int referenced;
>
> + cond_resched();
> +
> page = lru_to_page(page_list);
> list_del(&page->lru);
>
> @@ -710,6 +712,7 @@ refill_inactive_zone(struct zone *zone,
> reclaim_mapped = 1;
>
> while (!list_empty(&l_hold)) {
> + cond_resched();
> page = lru_to_page(&l_hold);
> list_del(&page->lru);
> if (page_mapped(page)) {

Could these ones go up a level? We break down scanning into 32 page
chunks, so I don't think it needs to be checked every page.

in shrink_zone(), maybe stick them:

while (nr_active || nr_inactive) {
if (nr_active) {
---> here
sc->nr_to_scan = min(nr_active,
(unsigned long)SWAP_CLUSTER_MAX);
nr_active -= sc->nr_to_scan;
refill_inactive_zone(zone, sc);
}

if (nr_inactive) {
---> and here
sc->nr_to_scan = min(nr_inactive,
(unsigned long)SWAP_CLUSTER_MAX);
nr_inactive -= sc->nr_to_scan;
shrink_cache(zone, sc);
if (sc->nr_to_reclaim <= 0)
break;
}
}

Does that work for you?