Skip to contentSkip to conversation

VM change in 2.4.10-pre3: don't call swap_out unless shortage

DISCUSSION Benjamin Redelings I 2 participants 2 messages Sep 1, 2001 – Sep 2, 2001 Memory management

lore
Share & tools
lore
#0 lore raw

Hi list,
I saw this change in 2.4.10-pre3, which seems to have some disadvantages:

Review

Quoted 9 lines

static int do_try_to_free_pages(unsigned int gfp_mask, int user) {

(quoted diff) +3 -2
-     /* Always walk at least the active queue when called */
-     int shortage = INACTIVE_SHORTAGE;
+     int shortage = 0;
      int maxtry;
 
+     /* Always walk at least the active queue when called */
+     refill_inactive_scan(DEF_PRIORITY);

This avoids swapping when there is no shortage, but it ALSO avoids looking at any hardware accessed bits, since swap_out does that.

In fact, I thought that Linus was thinking of renaming swap_out to something like scan_pages, since it doesn't actually swap things out - it just moves them to the swap cache. So, if the purpose of this change is to "avoid swapping when it is unnecessary" then isn't it doing the wrong thing? Shouldn't it instead make the kernel less aggressive in moving pages to the swap cache when there is no shortage (since we can't look at the hardware accessed bits any-more) or delay write-out of swap-cached pages until there is a shortage?

On the other hand, perhaps the intension is to avoid doing swap-out when there is a free shortage, but no inactive shortage? Or perhaps the intention is to avoid running swap_out every time kswapd runs?

I guess what I am really wondering is if there is some way that we could continue calling refill_inactive_scan while never calling swap_out (or only rarely). Because in that case it seems that page age's would be fairly innaccurate, since this test would almost never be true:

                /* Do aging on the pages. */
                if (PageTestandClearReferenced(page)) {
                        age_page_up(page);

Anyway, thanks for any explanation of what I'm missing!

-BenRI, looking forwards to reverse mapping...

Signature · 9 lines
"At this time Frodo was still in his 'tweens', as the hobbits called
the irresponsible twenties between childhood and coming-of-age at
thirty three" - The Fellowship of the Ring, J.R.R. Tolkein
Benjamin Redelings I      <><     http://www.bol.ucla.edu/~bredelin/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/
#1 lore raw
Quoted 3 lines · Benjamin Redelings I

I guess what I am really wondering is if there is some way that we could continue calling refill_inactive_scan while never calling swap_out (or only rarely).

You're absolutely right. Guess why Linus moved swap_out() to before refill_inactive_scan() in the first place ? ;)

Quoted 3 lines

Anyway, thanks for any explanation of what I'm missing!

-BenRI, looking forwards to reverse mapping...

I think you haven't missed a single detail here. Reverse mappings would indeed get rid of the whole unbalanced mess we have right now.

regards,

Rik

Signature · 10 lines
IA64: a worthy successor to i860.

http://www.surriel.com/		http://distro.conectiva.com/

Send all your spam to [email protected] (spam digging piggy)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/