forked from enlightenment/efl
evas: let's use HUGETLB when it makes sense.
This commit is contained in:
parent
af83a4511c
commit
8c094d1b2d
|
@ -113,6 +113,7 @@ static inline size_t
|
||||||
_evas_common_rgba_image_surface_size(unsigned int w, unsigned int h, Eina_Bool alpha_only)
|
_evas_common_rgba_image_surface_size(unsigned int w, unsigned int h, Eina_Bool alpha_only)
|
||||||
{
|
{
|
||||||
#define PAGE_SIZE (4 * 1024)
|
#define PAGE_SIZE (4 * 1024)
|
||||||
|
#define HUGE_PAGE_SIZE (2 * 1024 * 1024)
|
||||||
#if defined (HAVE_SYS_MMAN_H) && (!defined (_WIN32))
|
#if defined (HAVE_SYS_MMAN_H) && (!defined (_WIN32))
|
||||||
# define ALIGN_TO_PAGE(Siz) (((Siz / PAGE_SIZE) + (Siz % PAGE_SIZE ? 1 : 0)) * PAGE_SIZE)
|
# define ALIGN_TO_PAGE(Siz) (((Siz / PAGE_SIZE) + (Siz % PAGE_SIZE ? 1 : 0)) * PAGE_SIZE)
|
||||||
#else
|
#else
|
||||||
|
@ -136,7 +137,7 @@ static void *
|
||||||
_evas_common_rgba_image_surface_mmap(unsigned int w, unsigned int h, Eina_Bool alpha_only)
|
_evas_common_rgba_image_surface_mmap(unsigned int w, unsigned int h, Eina_Bool alpha_only)
|
||||||
{
|
{
|
||||||
size_t siz;
|
size_t siz;
|
||||||
void *r;
|
void *r = MAP_FAILED;
|
||||||
|
|
||||||
siz = _evas_common_rgba_image_surface_size(w, h, alpha_only);
|
siz = _evas_common_rgba_image_surface_size(w, h, alpha_only);
|
||||||
|
|
||||||
|
@ -154,6 +155,7 @@ _evas_common_rgba_image_surface_mmap(unsigned int w, unsigned int h, Eina_Bool a
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (siz > ((HUGE_PAGE_SIZE * 75) / 100))
|
||||||
r = mmap(NULL, siz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
|
r = mmap(NULL, siz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
|
||||||
if (r == MAP_FAILED)
|
if (r == MAP_FAILED)
|
||||||
r = mmap(NULL, siz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
r = mmap(NULL, siz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
|
|
Loading…
Reference in New Issue