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?

Kenn Humborg kenn at bluetree.ie
Tue Oct 1 09:51:02 IST 2002


> On Mon, Sep 30, 2002 at 09:03:06PM +0100, Kenn Humborg wrote:
> > 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.

Just a "niceness" issue.  If you've got two swap areas at prio -1
and -2, and you add a new one (bigger than the sum of the first two)
at prio -3, then swapoff the first one, and you've got a RAM deficit,
then stuff will swap out to the second one.  Then you switch this
one off, everything will migrate to the third one.  Whereas if you
make the third one a higher priority, stuff from the first will
go straight to the third.  Less wear on the disk heads, and all that :-)

>
> > 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.

Yes.  Unmodified code pages are backed by the executable file itself.
They never find their way to swap.  All modern OSes that I've looked
at (Linux, NT, VMS) do this.

> > 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
      ^^^^^^^^^^^^^^^

Probably won't work because virtual address space is not contiguous.
I'll need to look at /proc/PID/maps to get the list of valid regions.

>     	  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 :-)

:-)

And this machine will have plenty of PIDs that wrapped around.  It
stays up for a while.

Later,
Kenn




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