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

Re: [Xen-devel] Question about partitioning shared cache in Xen



Hi Jan,

2015-01-14 10:02 GMT-05:00 Jan Beulich <JBeulich@xxxxxxxx>:
>>>> On 14.01.15 at 15:45, <xumengpanda@xxxxxxxxx> wrote:
>> Yes. I try to use the bits [A16, A12] to isolate different colors in a
>> shared cache. A 2MB 16-way associate shared cache uses [A16, A6] to
>> index the cache set. Because page size is 4KB, we have page frame
>> number's bits [A16, A12] overlapped with the bits used to index a
>> shared cache's cache set. So we can control those [A16, A12] bits to
>> control where the page should be placed. (The wiki pages about page
>> coloring is here: http://en.wikipedia.org/wiki/Cache_coloring)
>
> But the majority of allocations done for guests would be as 2M or
> 1G pages,

First, I want to confirm my understanding is not incorrect: When Xen
allocate memory pages to guests, it current allocate a bunch of memory
pages at one time to guests. That's why you said the majority
allocation would be 2MB or 1GB. But the size of one memory page used
by guests is still 4KB. Am I correct?

If I'm correct, I will have the following argument. If I'm incorrect,
would you mind letting me know which function or file I should look at
to correct my understanding? (Thank you very much! )

====If I'm wrong in the size of one memory page, the following
argument won't hold and I need to first correct my above
understanding===
But can we allocate one memory page to guests until the guests have
enough pages?

I find in arch_setup_meminit() function in tools/libxc/xc_dom_x86.c
allocate memory pages depending on if the dom->superpages is true.
Can we add a if-else to allocate one page at each time to the guest
instead of allocate many pages in one time?

For example, if it's not superpages, we call
xc_domain_populate_physmap_exact_ca() to allocate one cache-colored
page each time.

        if ( num_cache_colors == 0 )

        {

            for ( i = rc = allocsz = 0;

                  (i < dom->total_pages) && !rc;

                  i += allocsz )

            {

                allocsz = dom->total_pages - i;

                if ( allocsz > 1024*1024 )

                    allocsz = 1024*1024;

                rc = xc_domain_populate_physmap_exact(

                    dom->xch, dom->guest_domid, allocsz,

                    0, 0, &dom->p2m_host[i]);

            }

        }

        else

        {

            for ( i = rc = allocsz = 0;

                (i < dom->total_pages) && !rc;

                i += allocsz )

            {

                allocsz = 1; /* TODO: change to allocate mulitple
pages when have memory pool */

                rc = xc_domain_populate_physmap_exact_ca(

                    dom->xch, dom->guest_domid, allocsz,

                    0, 0, &dom->p2m_host[i], cache_colors);

            }

        }



Thank you very much!

Best,

Meng



-- 


-----------
Meng Xu
PhD Student in Computer and Information Science
University of Pennsylvania

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.