clear_range_l1, clear_range_middle: Fix handling contiguous PTE

Change-Id: I2609c94d7f9342fe25aa9a5cfc208375274d46fa
This commit is contained in:
Masamichi Takagi
2018-12-13 16:54:05 +09:00
committed by Dominique Martinet
parent c1270cdf6d
commit 641d9f1b39
5 changed files with 97 additions and 98 deletions

View File

@@ -20,6 +20,7 @@
#include <errno.h>
#include <list.h>
#include <pager.h>
#include <page.h>
enum {
/* for memobj.flags */
@@ -153,4 +154,31 @@ int hugefileobj_create(struct memobj *obj, size_t len, off_t off,
int *pgshiftp, uintptr_t virt_addr);
void hugefileobj_cleanup(void);
static inline int is_flushable(struct page *page, struct memobj *memobj)
{
/* Only memory with backing store needs flush */
if (!page || !page_is_in_memobj(page))
return 0;
/* memobj could be NULL when calling ihk_mc_pt_clear_range()
* for range with memobj with pages.
* We don't call .flush_page for /dev/shm/ map.
*/
if (!memobj || (memobj->flags & (MF_ZEROFILL | MF_PRIVATE)))
return 0;
return 1;
}
static inline int is_freeable(struct memobj *memobj)
{
/* XPMEM attachment isn't freeable because it's an additional
* map to the first map of the exposed area.
*/
if (memobj && (memobj->flags & MF_XPMEM))
return 0;
return 1;
}
#endif /* HEADER_MEMOBJ_H */