Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _MM_PAGE_REPORTING_H
0003 #define _MM_PAGE_REPORTING_H
0004 
0005 #include <linux/mmzone.h>
0006 #include <linux/pageblock-flags.h>
0007 #include <linux/page-isolation.h>
0008 #include <linux/jump_label.h>
0009 #include <linux/slab.h>
0010 #include <linux/pgtable.h>
0011 #include <linux/scatterlist.h>
0012 
0013 #ifdef CONFIG_PAGE_REPORTING
0014 DECLARE_STATIC_KEY_FALSE(page_reporting_enabled);
0015 extern unsigned int page_reporting_order;
0016 void __page_reporting_notify(void);
0017 
0018 static inline bool page_reported(struct page *page)
0019 {
0020     return static_branch_unlikely(&page_reporting_enabled) &&
0021            PageReported(page);
0022 }
0023 
0024 /**
0025  * page_reporting_notify_free - Free page notification to start page processing
0026  *
0027  * This function is meant to act as a screener for __page_reporting_notify
0028  * which will determine if a give zone has crossed over the high-water mark
0029  * that will justify us beginning page treatment. If we have crossed that
0030  * threshold then it will start the process of pulling some pages and
0031  * placing them in the batch list for treatment.
0032  */
0033 static inline void page_reporting_notify_free(unsigned int order)
0034 {
0035     /* Called from hot path in __free_one_page() */
0036     if (!static_branch_unlikely(&page_reporting_enabled))
0037         return;
0038 
0039     /* Determine if we have crossed reporting threshold */
0040     if (order < page_reporting_order)
0041         return;
0042 
0043     /* This will add a few cycles, but should be called infrequently */
0044     __page_reporting_notify();
0045 }
0046 #else /* CONFIG_PAGE_REPORTING */
0047 #define page_reported(_page)    false
0048 
0049 static inline void page_reporting_notify_free(unsigned int order)
0050 {
0051 }
0052 #endif /* CONFIG_PAGE_REPORTING */
0053 #endif /*_MM_PAGE_REPORTING_H */