From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoGIl-0005gX-EF for qemu-devel@nongnu.org; Tue, 02 Aug 2011 10:50:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoGIk-0004c8-66 for qemu-devel@nongnu.org; Tue, 02 Aug 2011 10:50:35 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55997 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoGIj-0004bv-Qo for qemu-devel@nongnu.org; Tue, 02 Aug 2011 10:50:34 -0400 Message-ID: <4E380EB6.6050505@suse.de> Date: Tue, 02 Aug 2011 16:50:30 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1312226782-26882-2-git-send-email-anthony.perard@citrix.com> In-Reply-To: <1312226782-26882-2-git-send-email-anthony.perard@citrix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] xen-mapcache: Fix rlimit set size. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony PERARD Cc: Xen Devel , QEMU-devel , Stefano Stabellini On 08/01/2011 09:26 PM, Anthony PERARD wrote: > Previously, the address space soft limit was set mcache_max_size. So, > before the mcache_max_size was reached by the mapcache, QEMU was killed > for overuse of the virtual address space. > > This patch fix that by setting the soft limit to mcache_max_size + 80MB. > I observed that QEMU use 75MB more than max_mcache_size after several > empirical tests. Not sure I understand. What are those 75MB? Alex > Signed-off-by: Anthony PERARD > --- > xen-mapcache.c | 13 ++++++++++--- > 1 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/xen-mapcache.c b/xen-mapcache.c > index 007136a..40212f7 100644 > --- a/xen-mapcache.c > +++ b/xen-mapcache.c > @@ -40,6 +40,13 @@ > #endif > #define MCACHE_BUCKET_SIZE (1UL<< MCACHE_BUCKET_SHIFT) > > +/* This is the size of the virtual address space reserve to QEMU that will not > + * be use by MapCache. > + * From empirical tests I observed that qemu use 75MB more than the > + * max_mcache_size. > + */ > +#define NON_MCACHE_MEMORY_SIZE (80 * 1024 * 1024) > + > #define mapcache_lock() ((void)0) > #define mapcache_unlock() ((void)0) > > @@ -93,14 +100,14 @@ void xen_map_cache_init(void) > mapcache->last_address_index = -1; > > getrlimit(RLIMIT_AS,&rlimit_as); > - if (rlimit_as.rlim_max< MCACHE_MAX_SIZE) { > + if (rlimit_as.rlim_max< MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) { > rlimit_as.rlim_cur = rlimit_as.rlim_max; > } else { > - rlimit_as.rlim_cur = MCACHE_MAX_SIZE; > + rlimit_as.rlim_cur = MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE; > } > > setrlimit(RLIMIT_AS,&rlimit_as); > - mapcache->max_mcache_size = rlimit_as.rlim_cur; > + mapcache->max_mcache_size = rlimit_as.rlim_cur - NON_MCACHE_MEMORY_SIZE; > > mapcache->nr_buckets = > (((mapcache->max_mcache_size>> XC_PAGE_SHIFT) +