* [RFC]should swap-file opened with O_DIRECT?
@ 2005-10-10 13:46 Yingchao Zhou
2005-10-10 15:06 ` Hugh Dickins
0 siblings, 1 reply; 2+ messages in thread
From: Yingchao Zhou @ 2005-10-10 13:46 UTC (permalink / raw)
To: linux-kernel
The sys_swapon system call open the swap-file through
filp_open(..., O_RDWR|O_LARGEFILE,...).
In this way, I think that the pageout process of anonymous
pages finally will write them out through (swap-file)->f_ops->write,
and it will result in caches of swapfile. However, swapping only
happens when memory is tight. So why not set O_DIRECT? Is there any
special reason to keep caches of swapfile?
Is the idea right ? Or something misunstood?
Yingchao Zhou
yc_zhou@ncic.ac.cn
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC]should swap-file opened with O_DIRECT?
2005-10-10 13:46 [RFC]should swap-file opened with O_DIRECT? Yingchao Zhou
@ 2005-10-10 15:06 ` Hugh Dickins
0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2005-10-10 15:06 UTC (permalink / raw)
To: Yingchao Zhou; +Cc: linux-kernel
On Mon, 10 Oct 2005, Yingchao Zhou wrote:
>
> The sys_swapon system call open the swap-file through
> filp_open(..., O_RDWR|O_LARGEFILE,...).
> In this way, I think that the pageout process of anonymous
> pages finally will write them out through (swap-file)->f_ops->write,
No, they are written out by swap_writepage. The opening in sys_swapon
gets a handle of what is to be used for swap, but it then goes its own way.
> and it will result in caches of swapfile. However, swapping only
> happens when memory is tight. So why not set O_DIRECT? Is there any
> special reason to keep caches of swapfile?
Caches of swapfile are useful (but yes, can be discarded when memory
is tight). There's nothing indirect about them: the page that is mapped
into userspace gets written to disk, the page that is read in from disk
gets mapped back into userspace.
Hugh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-10 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-10 13:46 [RFC]should swap-file opened with O_DIRECT? Yingchao Zhou
2005-10-10 15:06 ` Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®