Re: swap cache

Prasun Kapoor (prasun@wipinfo.soft.net)
Fri, 18 Dec 1998 13:05:59 -0500 (GMT)


> > Yes, it's right. If fork() takes care of COW, then why swap-cache
> > should be used?.
>
> Fork obviously does _not_ take care of COW. Fork just creates a COW
> sharing in the first place. The actual "taking care of" such COW pages
> comes later, when processes start to take page faults on them or try to
> swap them out. That's why we have the swap cache. It lets us treat
> these COW anonymous pages as in-memory copies of the swap-entry on disk,
> so that the separate processes paging that data can do so independently.
>
> The real benefit of the swap cache is this: say we have a shared COW
> page on swap, and one process reads in that page. All other processes
> sharing that page still have references to the original entry on disk in
> their page tables. However, the swap cache lets us record the fact that
> the on-disk entry is now located in physical memory. As long as it
> remains in core, any other process accessing that same page will take a
> soft page fault and will find the existing page in memory rather than
> trying to read the page in from disk again. In other words, the two
> processes which originally shared the swap page on disk now share the
> swap cache page in memory.
>
> The swap cache is therefore *critical* to the maintainance of the COW
> pages created by fork.

Yes, I fully agree with the above description. But there has to be a
similar arragement for sharing pages of other mmap()ed files. And why is
the same arrangement not used for SWAP instead of having a seperate swap
cache.

prasun
> > --Stephen
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

_____________________________________________________________________________
"If seven maids with seven mops, Swept it for half a
Prasun Kapoor year, do you suppose" the Walrus said, "That they
Wipro Infotech Ltd. could get it clear"."I doubt it" said the Carpenter,
Ph. 2241730 Extn. 3312 and shed a bitter tear

"Through the looking glass and what alice found
there" - Alice in Wonderland -

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/