LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] "Swap-in" tool?

[ILUG] "Swap-in" tool?

Niall O Broin niall at linux.ie
Tue Oct 1 09:03:03 IST 2002


On Mon, Sep 30, 2002 at 09:03:06PM +0100, Kenn Humborg wrote:

> > I thought so too :-) and I hope Kenn lets us know if it works. But I fail to
> > see how it might be risky - it should be failsafe, in that as I described
> > it, the secondary swap is turned on before the primary is turned off, and
> > vice versa i.e. there should be no danger of running out of VM 
> 
> Your procedure doesn't actually work like you think.  Contrary to the
> swapoff(8) manpage, swapoff -a turns off ALL swap areas, not just those

Surprise me, why don't you. I did think it was remarkably handy that swapoff
-a would only turn off those listed in /etc/fstab. But that of course is
trivial e.g. swapoff `awk '/swap/ {print $1}' /etc/fstab`

> listed in /etc/fstab.  And you'll want to make sure that your temporary 
> swap area has a higher priority than your regular ones (if you have more
> than one) or you might find pages bouncing across multiple areas.

I don't see that swap priority is relevant apropos my original suggestion -
once you turn off swapping on your normal swap device, it oesn't matter what
way pages bounce around your replacement devices.

> I reckon I probably will, because the swap-frobbing method will leave the text
> pages out of memory, whereas PEEKTEXT-ing them will ensure that they are
> in.

I thought you might :-) - but why would "swap-frobbing method leave the
text pages out of memory" ? Surely as the swapped pages get moved out of the
swapped off area, they'll end up in memory ? Or is it that text pages aren't
swapped but rather paged, hence they don't get put into swap ? I'm not
familiar enough with how Linux handles paging/swapping to know what it does
in that area.

> And ptrace() lets me be selective about which processes I want to be resident.
> No need to page in a bunch of mingettys!

Well, yes, but really, are you going to bother ? When something as simple as 

for pid = 2 to PID_MAX
    word = 0
    while not errno
    	  data = ptrace(PTRACE_PEEKTEXT, pid, word, 0);
	  word++
    end
end

is going to touch every page, and if anything gets swapped back out, it will
be the earlier processes including mingettys etc. My logic falls down
slightly when you need to consider PID wraparound but damn it, I'm just
rambling here - you want a full & correct solution, email me for a quote :-)



Niall



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell