[PATCH] shrink_slab arith overflow fix
shrink_slab() wants to calculate nr_scanned_pages * seeks_per_object * entries_in_slab / nr_lru_pages entries_in_slab and nr_lru_pages can vary a lot. There is a potential for 32-bit overflows. I spent ages trying to avoid corner cases which cause a significant lack of precision while preserving some clarity. Gave up and used do_div(). The code is called rarely - at most once per 128 kbytes of reclaim. The patch adds a tweak to balance_pgdat() to reduce the call rate to shrink_slab() in the case where the zone is just a little bit below pages_high. Also increase SHRINK_BATCH. The things we're shrinking are typically a few hundred bytes, and a batchcount of 128 gives us a minimum of ten pages or so per shrinking callout.
Showing
Please register or sign in to comment