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