Haitao Shan
2011-Jan-28 04:40 UTC
[Xen-devel] [Patch] Fixing 1G page allocation algorithm in libxc
Hi, Keir, This patch fixes 1G page allocation algorithm in libxc. Currently, cur_pages (which is used as index into page_array for fetching gfns) is used to judge whether it is proper here to allocated 1G pages. However, cur_pages == page_array[cur_pages] only holds true when it is below 4G. When it is above 4G, page_array[cur_pages] - cur_pages = 256M. As a result, when guest has 10G memory, 8 1G-pages are allocated. But only 2 of them have their corresponding gfns 1G aligned. The other 6 are forced to split to 2M pages, as their starting gfns are 4G+256M, 5G+256M ................. Inside the patch, true gfns are used instead of cur_pages to fix this issue. Signed-off-by: Shan Haitao <haitao.shan@intel.com> Shan Haitao _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
George Dunlap
2011-Jan-28 10:33 UTC
Re: [Xen-devel] [Patch] Fixing 1G page allocation algorithm in libxc
Good catch. Thanks! Acked-by: George Dunlap <george.dunlap@citrix.com> -George On Fri, Jan 28, 2011 at 4:40 AM, Haitao Shan <maillists.shan@gmail.com> wrote:> Hi, Keir, > > This patch fixes 1G page allocation algorithm in libxc. > > Currently, cur_pages (which is used as index into page_array for > fetching gfns) is used to judge whether it is proper here to allocated > 1G pages. However, cur_pages == page_array[cur_pages] only holds true > when it is below 4G. When it is above 4G, page_array[cur_pages] - > cur_pages = 256M. > As a result, when guest has 10G memory, 8 1G-pages are allocated. But > only 2 of them have their corresponding gfns 1G aligned. The other 6 > are forced to split to 2M pages, as their starting gfns are 4G+256M, > 5G+256M ................. > > Inside the patch, true gfns are used instead of cur_pages to fix this issue. > > Signed-off-by: Shan Haitao <haitao.shan@intel.com> > > Shan Haitao > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel