~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/mm/vm_util.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #include <stdint.h>
  3 #include <stdbool.h>
  4 #include <sys/mman.h>
  5 #include <err.h>
  6 #include <strings.h> /* ffsl() */
  7 #include <unistd.h> /* _SC_PAGESIZE */
  8 
  9 #define BIT_ULL(nr)                   (1ULL << (nr))
 10 #define PM_SOFT_DIRTY                 BIT_ULL(55)
 11 #define PM_MMAP_EXCLUSIVE             BIT_ULL(56)
 12 #define PM_UFFD_WP                    BIT_ULL(57)
 13 #define PM_FILE                       BIT_ULL(61)
 14 #define PM_SWAP                       BIT_ULL(62)
 15 #define PM_PRESENT                    BIT_ULL(63)
 16 
 17 extern unsigned int __page_size;
 18 extern unsigned int __page_shift;
 19 
 20 static inline unsigned int psize(void)
 21 {
 22         if (!__page_size)
 23                 __page_size = sysconf(_SC_PAGESIZE);
 24         return __page_size;
 25 }
 26 
 27 static inline unsigned int pshift(void)
 28 {
 29         if (!__page_shift)
 30                 __page_shift = (ffsl(psize()) - 1);
 31         return __page_shift;
 32 }
 33 
 34 uint64_t pagemap_get_entry(int fd, char *start);
 35 bool pagemap_is_softdirty(int fd, char *start);
 36 bool pagemap_is_swapped(int fd, char *start);
 37 bool pagemap_is_populated(int fd, char *start);
 38 unsigned long pagemap_get_pfn(int fd, char *start);
 39 void clear_softdirty(void);
 40 bool check_for_pattern(FILE *fp, const char *pattern, char *buf, size_t len);
 41 uint64_t read_pmd_pagesize(void);
 42 bool check_huge_anon(void *addr, int nr_hpages, uint64_t hpage_size);
 43 bool check_huge_file(void *addr, int nr_hpages, uint64_t hpage_size);
 44 bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size);
 45 int64_t allocate_transhuge(void *ptr, int pagemap_fd);
 46 unsigned long default_huge_page_size(void);
 47 int detect_hugetlb_page_sizes(size_t sizes[], int max);
 48 
 49 int uffd_register(int uffd, void *addr, uint64_t len,
 50                   bool miss, bool wp, bool minor);
 51 int uffd_unregister(int uffd, void *addr, uint64_t len);
 52 int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len,
 53                               bool miss, bool wp, bool minor, uint64_t *ioctls);
 54 unsigned long get_free_hugepages(void);
 55 
 56 /*
 57  * On ppc64 this will only work with radix 2M hugepage size
 58  */
 59 #define HPAGE_SHIFT 21
 60 #define HPAGE_SIZE (1 << HPAGE_SHIFT)
 61 
 62 #define PAGEMAP_PRESENT(ent)    (((ent) & (1ull << 63)) != 0)
 63 #define PAGEMAP_PFN(ent)        ((ent) & ((1ull << 55) - 1))
 64 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php