All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: balbir@linux.vnet.ibm.com
Cc: KVM development list <kvm@vger.kernel.org>,
	Rik van Riel <riel@surriel.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter
Date: Mon, 15 Mar 2010 11:27:56 +0200	[thread overview]
Message-ID: <4B9DFD9C.8030608@redhat.com> (raw)
In-Reply-To: <20100315091720.GC18054@balbir.in.ibm.com>

On 03/15/2010 11:17 AM, Balbir Singh wrote:
> * Avi Kivity<avi@redhat.com>  [2010-03-15 10:27:45]:
>
>    
>> On 03/15/2010 10:07 AM, Balbir Singh wrote:
>>      
>>> * Avi Kivity<avi@redhat.com>   [2010-03-15 09:48:05]:
>>>
>>>        
>>>> On 03/15/2010 09:22 AM, Balbir Singh wrote:
>>>>          
>>>>> Selectively control Unmapped Page Cache (nospam version)
>>>>>
>>>>> From: Balbir Singh<balbir@linux.vnet.ibm.com>
>>>>>
>>>>> This patch implements unmapped page cache control via preferred
>>>>> page cache reclaim. The current patch hooks into kswapd and reclaims
>>>>> page cache if the user has requested for unmapped page control.
>>>>> This is useful in the following scenario
>>>>>
>>>>> - In a virtualized environment with cache!=none, we see
>>>>>    double caching - (one in the host and one in the guest). As
>>>>>    we try to scale guests, cache usage across the system grows.
>>>>>    The goal of this patch is to reclaim page cache when Linux is running
>>>>>    as a guest and get the host to hold the page cache and manage it.
>>>>>    There might be temporary duplication, but in the long run, memory
>>>>>    in the guests would be used for mapped pages.
>>>>>            
>>>> Well, for a guest, host page cache is a lot slower than guest page cache.
>>>>
>>>>          
>>> Yes, it is a virtio call away, but is the cost of paying twice in
>>> terms of memory acceptable?
>>>        
>> Usually, it isn't, which is why I recommend cache=off.
>>
>>      
> cache=off works for *direct I/O* supported filesystems and my concern is that
> one of the side-effects is that idle VM's can consume a lot of memory
> (assuming all the memory is available to them). As the number of VM's
> grow, they could cache a whole lot of memory. In my experiments I
> found that the total amount of memory cached far exceeded the mapped
> ratio by a large amount when we had idle VM's. The philosophy of this
> patch is to move the caching to the _host_ and let the host maintain
> the cache instead of the guest.
>    

That's only beneficial if the cache is shared.  Otherwise, you could use 
the balloon to evict cache when memory is tight.

Shared cache is mostly a desktop thing where users run similar 
workloads.  For servers, it's much less likely.  So a modified-guest 
doesn't help a lot here.

>>> One of the reasons I created a boot
>>> parameter was to deal with selective enablement for cases where
>>> memory is the most important resource being managed.
>>>
>>> I do see a hit in performance with my results (please see the data
>>> below), but the savings are quite large. The other solution mentioned
>>> in the TODOs is to have the balloon driver invoke this path. The
>>> sysctl also allows the guest to tune the amount of unmapped page cache
>>> if needed.
>>>
>>> The knobs are for
>>>
>>> 1. Selective enablement
>>> 2. Selective control of the % of unmapped pages
>>>        
>> An alternative path is to enable KSM for page cache.  Then we have
>> direct read-only guest access to host page cache, without any guest
>> modifications required.  That will be pretty difficult to achieve
>> though - will need a readonly bit in the page cache radix tree, and
>> teach all paths to honour it.
>>
>>      
> Yes, it is, I've taken a quick look. I am not sure if de-duplication
> would be the best approach, may be dropping the page in the page cache
> might be a good first step. Data consistency would be much easier to
> maintain that way, as long as the guest is not writing frequently to
> that page, we don't need the page cache in the host.
>    

Trimming the host page cache should happen automatically under 
pressure.  Since the page is cached by the guest, it won't be re-read, 
so the host page is not frequently used and then dropped.

-- 
error compiling committee.c: too many arguments to function


WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com>
To: balbir@linux.vnet.ibm.com
Cc: KVM development list <kvm@vger.kernel.org>,
	Rik van Riel <riel@surriel.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter
Date: Mon, 15 Mar 2010 11:27:56 +0200	[thread overview]
Message-ID: <4B9DFD9C.8030608@redhat.com> (raw)
In-Reply-To: <20100315091720.GC18054@balbir.in.ibm.com>

On 03/15/2010 11:17 AM, Balbir Singh wrote:
> * Avi Kivity<avi@redhat.com>  [2010-03-15 10:27:45]:
>
>    
>> On 03/15/2010 10:07 AM, Balbir Singh wrote:
>>      
>>> * Avi Kivity<avi@redhat.com>   [2010-03-15 09:48:05]:
>>>
>>>        
>>>> On 03/15/2010 09:22 AM, Balbir Singh wrote:
>>>>          
>>>>> Selectively control Unmapped Page Cache (nospam version)
>>>>>
>>>>> From: Balbir Singh<balbir@linux.vnet.ibm.com>
>>>>>
>>>>> This patch implements unmapped page cache control via preferred
>>>>> page cache reclaim. The current patch hooks into kswapd and reclaims
>>>>> page cache if the user has requested for unmapped page control.
>>>>> This is useful in the following scenario
>>>>>
>>>>> - In a virtualized environment with cache!=none, we see
>>>>>    double caching - (one in the host and one in the guest). As
>>>>>    we try to scale guests, cache usage across the system grows.
>>>>>    The goal of this patch is to reclaim page cache when Linux is running
>>>>>    as a guest and get the host to hold the page cache and manage it.
>>>>>    There might be temporary duplication, but in the long run, memory
>>>>>    in the guests would be used for mapped pages.
>>>>>            
>>>> Well, for a guest, host page cache is a lot slower than guest page cache.
>>>>
>>>>          
>>> Yes, it is a virtio call away, but is the cost of paying twice in
>>> terms of memory acceptable?
>>>        
>> Usually, it isn't, which is why I recommend cache=off.
>>
>>      
> cache=off works for *direct I/O* supported filesystems and my concern is that
> one of the side-effects is that idle VM's can consume a lot of memory
> (assuming all the memory is available to them). As the number of VM's
> grow, they could cache a whole lot of memory. In my experiments I
> found that the total amount of memory cached far exceeded the mapped
> ratio by a large amount when we had idle VM's. The philosophy of this
> patch is to move the caching to the _host_ and let the host maintain
> the cache instead of the guest.
>    

That's only beneficial if the cache is shared.  Otherwise, you could use 
the balloon to evict cache when memory is tight.

Shared cache is mostly a desktop thing where users run similar 
workloads.  For servers, it's much less likely.  So a modified-guest 
doesn't help a lot here.

>>> One of the reasons I created a boot
>>> parameter was to deal with selective enablement for cases where
>>> memory is the most important resource being managed.
>>>
>>> I do see a hit in performance with my results (please see the data
>>> below), but the savings are quite large. The other solution mentioned
>>> in the TODOs is to have the balloon driver invoke this path. The
>>> sysctl also allows the guest to tune the amount of unmapped page cache
>>> if needed.
>>>
>>> The knobs are for
>>>
>>> 1. Selective enablement
>>> 2. Selective control of the % of unmapped pages
>>>        
>> An alternative path is to enable KSM for page cache.  Then we have
>> direct read-only guest access to host page cache, without any guest
>> modifications required.  That will be pretty difficult to achieve
>> though - will need a readonly bit in the page cache radix tree, and
>> teach all paths to honour it.
>>
>>      
> Yes, it is, I've taken a quick look. I am not sure if de-duplication
> would be the best approach, may be dropping the page in the page cache
> might be a good first step. Data consistency would be much easier to
> maintain that way, as long as the guest is not writing frequently to
> that page, we don't need the page cache in the host.
>    

Trimming the host page cache should happen automatically under 
pressure.  Since the page is cached by the guest, it won't be re-read, 
so the host page is not frequently used and then dropped.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-03-15  9:28 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15  7:22 [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter Balbir Singh
2010-03-15  7:22 ` Balbir Singh
2010-03-15  7:48 ` Avi Kivity
2010-03-15  7:48   ` Avi Kivity
2010-03-15  8:07   ` Balbir Singh
2010-03-15  8:07     ` Balbir Singh
2010-03-15  8:27     ` Avi Kivity
2010-03-15  8:27       ` Avi Kivity
2010-03-15  9:17       ` Balbir Singh
2010-03-15  9:17         ` Balbir Singh
2010-03-15  9:27         ` Avi Kivity [this message]
2010-03-15  9:27           ` Avi Kivity
2010-03-15 10:45           ` Balbir Singh
2010-03-15 10:45             ` Balbir Singh
2010-03-15 18:48           ` Anthony Liguori
2010-03-15 18:48             ` Anthony Liguori
2010-03-16  9:05             ` Avi Kivity
2010-03-16  9:05               ` Avi Kivity
2010-03-19  7:23               ` Dave Hansen
2010-03-19  7:23                 ` Dave Hansen
2010-03-15 20:23       ` Chris Webb
2010-03-15 20:23         ` Chris Webb
2010-03-15 23:43         ` Anthony Liguori
2010-03-15 23:43           ` Anthony Liguori
2010-03-16  0:43           ` Christoph Hellwig
2010-03-16  0:43             ` Christoph Hellwig
2010-03-16  1:27             ` Anthony Liguori
2010-03-16  1:27               ` Anthony Liguori
2010-03-16  8:19               ` Christoph Hellwig
2010-03-16  8:19                 ` Christoph Hellwig
2010-03-17 15:14           ` Chris Webb
2010-03-17 15:14             ` Chris Webb
2010-03-17 15:55             ` Anthony Liguori
2010-03-17 15:55               ` Anthony Liguori
2010-03-17 16:27               ` Chris Webb
2010-03-17 16:27                 ` Chris Webb
2010-03-22 21:04                 ` Chris Webb
2010-03-22 21:04                   ` Chris Webb
2010-03-22 21:07                   ` Avi Kivity
2010-03-22 21:07                     ` Avi Kivity
2010-03-22 21:10                     ` Chris Webb
2010-03-22 21:10                       ` Chris Webb
2010-03-17 16:27               ` Balbir Singh
2010-03-17 16:27                 ` Balbir Singh
2010-03-17 17:05             ` Vivek Goyal
2010-03-17 17:05               ` Vivek Goyal
2010-03-17 19:11               ` Chris Webb
2010-03-17 19:11                 ` Chris Webb
2010-03-16  3:16         ` Balbir Singh
2010-03-16  3:16           ` Balbir Singh
2010-03-16  9:17         ` Avi Kivity
2010-03-16  9:17           ` Avi Kivity
2010-03-16  9:54           ` Kevin Wolf
2010-03-16  9:54             ` Kevin Wolf
2010-03-16 10:16             ` Avi Kivity
2010-03-16 10:16               ` Avi Kivity
2010-03-16 10:26           ` Christoph Hellwig
2010-03-16 10:26             ` Christoph Hellwig
2010-03-16 10:36             ` Avi Kivity
2010-03-16 10:36               ` Avi Kivity
2010-03-16 10:44               ` Christoph Hellwig
2010-03-16 10:44                 ` Christoph Hellwig
2010-03-16 11:08                 ` Avi Kivity
2010-03-16 11:08                   ` Avi Kivity
2010-03-16 14:27                   ` Balbir Singh
2010-03-16 14:27                     ` Balbir Singh
2010-03-16 15:59                     ` Avi Kivity
2010-03-16 15:59                       ` Avi Kivity
2010-03-17  8:49                   ` Christoph Hellwig
2010-03-17  8:49                     ` Christoph Hellwig
2010-03-17  9:10                     ` Avi Kivity
2010-03-17  9:10                       ` Avi Kivity
2010-03-17 15:24           ` Chris Webb
2010-03-17 15:24             ` Chris Webb
2010-03-17 16:22             ` Avi Kivity
2010-03-17 16:22               ` Avi Kivity
2010-03-17 16:40               ` Avi Kivity
2010-03-17 16:40                 ` Avi Kivity
2010-03-17 16:47                 ` Chris Webb
2010-03-17 16:47                   ` Chris Webb
2010-03-17 16:53                   ` Avi Kivity
2010-03-17 16:53                     ` Avi Kivity
2010-03-17 16:58                     ` Christoph Hellwig
2010-03-17 16:58                       ` Christoph Hellwig
2010-03-17 17:03                       ` Avi Kivity
2010-03-17 17:03                         ` Avi Kivity
2010-03-17 16:57                 ` Christoph Hellwig
2010-03-17 16:57                   ` Christoph Hellwig
2010-03-17 17:06                   ` Avi Kivity
2010-03-17 17:06                     ` Avi Kivity
2010-03-17 16:52               ` Christoph Hellwig
2010-03-17 16:52                 ` Christoph Hellwig
2010-03-17 17:02                 ` Avi Kivity
2010-03-17 17:02                   ` Avi Kivity
2010-03-15 15:46 ` Randy Dunlap
2010-03-15 15:46   ` Randy Dunlap
2010-03-16  3:21   ` Balbir Singh
2010-03-16  3:21     ` Balbir Singh

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=4B9DFD9C.8030608@redhat.com \
    --to=avi@redhat.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@surriel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.