From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIaQb-0007XN-RA for qemu-devel@nongnu.org; Wed, 26 Feb 2014 04:05:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIaQT-0000DS-9N for qemu-devel@nongnu.org; Wed, 26 Feb 2014 04:05:21 -0500 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:36220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIaQT-0000DN-4G for qemu-devel@nongnu.org; Wed, 26 Feb 2014 04:05:13 -0500 Received: by mail-qa0-f43.google.com with SMTP id o15so1899868qap.16 for ; Wed, 26 Feb 2014 01:05:12 -0800 (PST) Sender: Paolo Bonzini Message-ID: <530DAE42.3020609@redhat.com> Date: Wed, 26 Feb 2014 10:05:06 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <53047351.80300@redhat.com> <20140219103657.4daed264@nial.usersys.redhat.com> <20140226055706.GA5090@G08FNSTD100614.fnst.cn.fujitsu.com> In-Reply-To: <20140226055706.GA5090@G08FNSTD100614.fnst.cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , Igor Mammedov Cc: lersek@redhat.com, qemu-devel@nongnu.org, Wanlong Gao Il 26/02/2014 06:57, Hu Tao ha scritto: > If lines about memory polices are moved up to hostmem.c, the only thing > left in ram_backend_memory_init() is calling memory_region_init_ram() to > allocate memory. Then it comes a problem that when to apply memory > polices? Choices: > > 1. apply memory polices in hostmem.c since this is the place user sets > memory polices. But user_creatable_complete() seems not to support > this.( but fix me) > > 2. cast to HostMemoryBackend in ram_backend_memory_init() (or in other > memory backends) and add lines to apply memory polices. > > 3. provide an interface in HostMemoryBackendClass to do the thing and > call it in subclasses. (this is basically the same as 2 except that > we can reuse code) I like (3). I understand it's something like void memory_backend_apply_mempolicy(HostMemoryBackend *be, void *addr, size_t len, Error **err) ? Paolo