Re: swap out memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/8/6, Shaohua Li <shaoh.li@xxxxxxxxx>:
> Hi,
> I'm trying to swap out kvm guest pages. The idea is to free some pages
> when memory pressure is high. kvm has special things to handle like
> shadow page tables. Before guest page is released, we need free some
> data, that is guest page has 'private' data, so we can't directly make
> the guest page swapout with Linux swapout mechanism. I'd like write
> guest pages to a file or swap. kvm guest pages are in its address
> space and added into lru list like normal page (the address space is
> very like a shmem file's, kvm has a memory based file system). When
> vmscan decided to free one guest page, kvm guest pages's
> aops.writepage will free the private data and then write it out to
> block device. The problem is how to write guest pages. I thought we
> have some choices:
>
> 1. swap it to swapfile. Like shmem does, using move_to_swap_cache to
> move guest page from its address space to swap address space, and
> finally it's written to swapfile. This method works well, but as kvm
> is a module, I must export some swap relelated APIs, which Christoph
> Hellwig dislike.
>
> 2. write it to a file. Just like the stack fs does, in kvm address
> space's .writepage, let low fs's aops write the page. This involves
> allocating a new page for low fs file and copy kvm page to the new
> page. As this (doing swap) is done when memory is tight, allocating
> new page isn't good. The copy isn't good too.
>
> 3.write it to a file. Using bmap to get file's block info and using
> low level sumbit_bio for read/write. This is like what swapfile does,
> but we do it by ourselves, so don't need use swap symbols.
>
> Do you have any suggestion which method is good, or if you have better
> choice I could try?
Can anybody share some hints? I really apprecate any comments.

Thanks,
Shaohua
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux