Server IP : 172.67.216.182 / Your IP : 172.70.142.151 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/src/linux-headers-5.15.0-143/include/linux/ |
Upload File : |
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_FRONTSWAP_H #define _LINUX_FRONTSWAP_H #include <linux/swap.h> #include <linux/mm.h> #include <linux/bitops.h> #include <linux/jump_label.h> /* * Return code to denote that requested number of * frontswap pages are unused(moved to page cache). * Used in shmem_unuse and try_to_unuse. */ #define FRONTSWAP_PAGES_UNUSED 2 struct frontswap_ops { void (*init)(unsigned); /* this swap type was just swapon'ed */ int (*store)(unsigned, pgoff_t, struct page *); /* store a page */ int (*load)(unsigned, pgoff_t, struct page *); /* load a page */ void (*invalidate_page)(unsigned, pgoff_t); /* page no longer needed */ void (*invalidate_area)(unsigned); /* swap type just swapoff'ed */ struct frontswap_ops *next; /* private pointer to next ops */ }; extern void frontswap_register_ops(struct frontswap_ops *ops); extern void frontswap_shrink(unsigned long); extern unsigned long frontswap_curr_pages(void); extern void frontswap_writethrough(bool); #define FRONTSWAP_HAS_EXCLUSIVE_GETS extern void frontswap_tmem_exclusive_gets(bool); extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); extern void __frontswap_init(unsigned type, unsigned long *map); extern int __frontswap_store(struct page *page); extern int __frontswap_load(struct page *page); extern void __frontswap_invalidate_page(unsigned, pgoff_t); extern void __frontswap_invalidate_area(unsigned); #ifdef CONFIG_FRONTSWAP extern struct static_key_false frontswap_enabled_key; static inline bool frontswap_enabled(void) { return static_branch_unlikely(&frontswap_enabled_key); } static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) { return __frontswap_test(sis, offset); } static inline void frontswap_map_set(struct swap_info_struct *p, unsigned long *map) { p->frontswap_map = map; } static inline unsigned long *frontswap_map_get(struct swap_info_struct *p) { return p->frontswap_map; } #else /* all inline routines become no-ops and all externs are ignored */ static inline bool frontswap_enabled(void) { return false; } static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) { return false; } static inline void frontswap_map_set(struct swap_info_struct *p, unsigned long *map) { } static inline unsigned long *frontswap_map_get(struct swap_info_struct *p) { return NULL; } #endif static inline int frontswap_store(struct page *page) { if (frontswap_enabled()) return __frontswap_store(page); return -1; } static inline int frontswap_load(struct page *page) { if (frontswap_enabled()) return __frontswap_load(page); return -1; } static inline void frontswap_invalidate_page(unsigned type, pgoff_t offset) { if (frontswap_enabled()) __frontswap_invalidate_page(type, offset); } static inline void frontswap_invalidate_area(unsigned type) { if (frontswap_enabled()) __frontswap_invalidate_area(type); } static inline void frontswap_init(unsigned type, unsigned long *map) { #ifdef CONFIG_FRONTSWAP __frontswap_init(type, map); #endif } #endif /* _LINUX_FRONTSWAP_H */