(7/25/13 9:22 PM), Bob Liu wrote:
Hi Kosaki,
On Fri, Jul 26, 2013 at 2:14 AM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxx> wrote:
How about replace the checking in kswapd_shrink_zone()?
@@ -2824,7 +2824,7 @@ static bool kswapd_shrink_zone(struct zone *zone,
/* Account for the number of pages attempted to reclaim */
*nr_attempted += sc->nr_to_reclaim;
- if (nr_slab == 0 && !zone_reclaimable(zone))
+ if (sc->nr_reclaimed == 0 && !zone_reclaimable(zone))
zone->all_unreclaimable = 1;
zone_clear_flag(zone, ZONE_WRITEBACK);
I think the current check is wrong, reclaimed a slab doesn't mean
reclaimed a page.
The code is correct, at least, it works as intentional. page reclaim
status is checked by zone_reclaimable() and slab shrinking status is
checked by nr_slab.
I'm afraid in some special cases, nr_slab = 1 or any small number
which means we reclaimed some slab objects.
Then we don't set zone->all_unreclaimeabled =1.
But even though we reclaimed some slab objects, there may be no pages freed.
Because one page may contain several objects.
Right. This is a limitation of current slab shrinker's implementation.
We are welcome you contribution this area.
If we reclaimed some slab objects but without actual pages, we need to
set zone->all_unreclaimeabled=1!
So I think we should check sc->nr_reclaimed == 0 instead of nr_slab == 0.
sc->nr_reclaimed doesn't check how much pages freed from slab.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>