kowr / compcache

Automatically exported from code.google.com/p/compcache
0 stars 0 forks source link

Configure swap free notify frequency #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is there a way to configure how often swap free notify occurs?  I've
noticed that compcache seems to be more aggressive in freeing up stale
pages than regular linux swap, which is causing applications to be
offloaded from memory/swap faster than I would like.

I've played around with swappiness but that seems to control how often
pages are moved to swap and not often often pages are freed from swap.

I'm running latest compcache 0.6 on android with 2.26.29 kernel using
cyanogen's 4.1.9 ROM.

Original issue reported on code.google.com by dwa...@gmail.com on 14 Sep 2009 at 4:20

GoogleCodeExporter commented 9 years ago
Notify callback frees pages that are useless -- these pages will never be used 
again. 

From your description, it seems you have understanding that these pages are
_unlikely_ to be used in future so it might make sense to not to free them very
frequently. However, as mentioned above, these pages are stale and will never 
be used
again. So, freeing then ASAP is best we can do.

Original comment by nitingupta910@gmail.com on 14 Sep 2009 at 4:34

GoogleCodeExporter commented 9 years ago
How are stale pages determined?

With the same linux swap settings, I don't see the application being freed as 
often
compared to compcache.

Original comment by dwa...@gmail.com on 14 Sep 2009 at 4:44

GoogleCodeExporter commented 9 years ago
> How are stale pages determined?

Application pages become stale when:
 - It frees some memory (apps typically do alloc/free very regularly).
 - It exits.
In both these cases, freeing these stale pages ASAP is the best option.

Another case when page becomes stale:
 - App page 3 swapped out to swap slot 7.
 - It tries to read page 3, so we go to swap to fetch the page.
 - If the swap is currently > 50% full, we disassociate slot 7 with this page 3
   - So, the slot 7 becomes stale <-----
   - Should we keep this stale page any longer in compcache expecting it will be used
again? No. Since in future, if we again swap-out this page 3, it will go to some
other swap slot and its contents can also change (and hence out of sync with
compcache) during this time.

Original comment by nitingupta910@gmail.com on 14 Sep 2009 at 6:27

GoogleCodeExporter commented 9 years ago
I think I figured out the issue.  Cyanogen ROMs have the vm.page-cluster value 
set to
0 by default, which means only 1 page is written to swap in a single attempt.  
Moving
it to a higher value and seems to have solved my problems.

Original comment by dwa...@gmail.com on 15 Sep 2009 at 2:31

GoogleCodeExporter commented 9 years ago
Ok, then closing the bug.

Original comment by nitingupta910@gmail.com on 16 Sep 2009 at 3:11