mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Yingchao Zhou <yc_zhou@ncic.ac.cn>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC]should swap-file opened with O_DIRECT?
Date: Mon, 10 Oct 2005 16:06:06 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0510101558140.1168@goblin.wat.veritas.com> (raw)
In-Reply-To: <20051010135229.D29B5FB048@gatekeeper.ncic.ac.cn>

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

      reply	other threads:[~2005-10-10 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10 13:46 Yingchao Zhou
2005-10-10 15:06 ` Hugh Dickins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0510101558140.1168@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yc_zhou@ncic.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®