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

TOMOYO Linux Cross Reference
Linux/include/linux/page_idle.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 #ifndef _LINUX_MM_PAGE_IDLE_H
  3 #define _LINUX_MM_PAGE_IDLE_H
  4 
  5 #include <linux/bitops.h>
  6 #include <linux/page-flags.h>
  7 #include <linux/page_ext.h>
  8 
  9 #if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT)
 10 /*
 11  * If there is not enough space to store Idle and Young bits in page flags, use
 12  * page ext flags instead.
 13  */
 14 static inline bool folio_test_young(const struct folio *folio)
 15 {
 16         struct page_ext *page_ext = page_ext_get(&folio->page);
 17         bool page_young;
 18 
 19         if (unlikely(!page_ext))
 20                 return false;
 21 
 22         page_young = test_bit(PAGE_EXT_YOUNG, &page_ext->flags);
 23         page_ext_put(page_ext);
 24 
 25         return page_young;
 26 }
 27 
 28 static inline void folio_set_young(struct folio *folio)
 29 {
 30         struct page_ext *page_ext = page_ext_get(&folio->page);
 31 
 32         if (unlikely(!page_ext))
 33                 return;
 34 
 35         set_bit(PAGE_EXT_YOUNG, &page_ext->flags);
 36         page_ext_put(page_ext);
 37 }
 38 
 39 static inline bool folio_test_clear_young(struct folio *folio)
 40 {
 41         struct page_ext *page_ext = page_ext_get(&folio->page);
 42         bool page_young;
 43 
 44         if (unlikely(!page_ext))
 45                 return false;
 46 
 47         page_young = test_and_clear_bit(PAGE_EXT_YOUNG, &page_ext->flags);
 48         page_ext_put(page_ext);
 49 
 50         return page_young;
 51 }
 52 
 53 static inline bool folio_test_idle(const struct folio *folio)
 54 {
 55         struct page_ext *page_ext = page_ext_get(&folio->page);
 56         bool page_idle;
 57 
 58         if (unlikely(!page_ext))
 59                 return false;
 60 
 61         page_idle = test_bit(PAGE_EXT_IDLE, &page_ext->flags);
 62         page_ext_put(page_ext);
 63 
 64         return page_idle;
 65 }
 66 
 67 static inline void folio_set_idle(struct folio *folio)
 68 {
 69         struct page_ext *page_ext = page_ext_get(&folio->page);
 70 
 71         if (unlikely(!page_ext))
 72                 return;
 73 
 74         set_bit(PAGE_EXT_IDLE, &page_ext->flags);
 75         page_ext_put(page_ext);
 76 }
 77 
 78 static inline void folio_clear_idle(struct folio *folio)
 79 {
 80         struct page_ext *page_ext = page_ext_get(&folio->page);
 81 
 82         if (unlikely(!page_ext))
 83                 return;
 84 
 85         clear_bit(PAGE_EXT_IDLE, &page_ext->flags);
 86         page_ext_put(page_ext);
 87 }
 88 #endif /* CONFIG_PAGE_IDLE_FLAG && !64BIT */
 89 #endif /* _LINUX_MM_PAGE_IDLE_H */
 90 

~ [ 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