Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/compaction: make defer_compaction and compaction_deferred static

defer_compaction() and compaction_deferred() and compaction_restarting()
in mm/compaction.c won't be used in other files, so make them static, and
remove the declaration in the header file.

Take the chance to fix a typo.

Link: https://lkml.kernel.org/r/20201123170801.GA9625@rlk
Signed-off-by: Hui Su <sh_def@163.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Nitin Gupta <nigupta@nvidia.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Mateusz Nosek <mateusznosek0@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hui Su and committed by
Linus Torvalds
2271b016 2b1a20c3

+4 -16
-12
include/linux/compaction.h
··· 98 98 extern enum compact_result compaction_suitable(struct zone *zone, int order, 99 99 unsigned int alloc_flags, int highest_zoneidx); 100 100 101 - extern void defer_compaction(struct zone *zone, int order); 102 - extern bool compaction_deferred(struct zone *zone, int order); 103 101 extern void compaction_defer_reset(struct zone *zone, int order, 104 102 bool alloc_success); 105 - extern bool compaction_restarting(struct zone *zone, int order); 106 103 107 104 /* Compaction has made some progress and retrying makes sense */ 108 105 static inline bool compaction_made_progress(enum compact_result result) ··· 189 192 int alloc_flags, int highest_zoneidx) 190 193 { 191 194 return COMPACT_SKIPPED; 192 - } 193 - 194 - static inline void defer_compaction(struct zone *zone, int order) 195 - { 196 - } 197 - 198 - static inline bool compaction_deferred(struct zone *zone, int order) 199 - { 200 - return true; 201 195 } 202 196 203 197 static inline bool compaction_made_progress(enum compact_result result)
+4 -4
mm/compaction.c
··· 157 157 * allocation success. 1 << compact_defer_shift, compactions are skipped up 158 158 * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT 159 159 */ 160 - void defer_compaction(struct zone *zone, int order) 160 + static void defer_compaction(struct zone *zone, int order) 161 161 { 162 162 zone->compact_considered = 0; 163 163 zone->compact_defer_shift++; ··· 172 172 } 173 173 174 174 /* Returns true if compaction should be skipped this time */ 175 - bool compaction_deferred(struct zone *zone, int order) 175 + static bool compaction_deferred(struct zone *zone, int order) 176 176 { 177 177 unsigned long defer_limit = 1UL << zone->compact_defer_shift; 178 178 ··· 209 209 } 210 210 211 211 /* Returns true if restarting compaction after many failures */ 212 - bool compaction_restarting(struct zone *zone, int order) 212 + static bool compaction_restarting(struct zone *zone, int order) 213 213 { 214 214 if (order < zone->compact_order_failed) 215 215 return false; ··· 237 237 } 238 238 239 239 /* 240 - * Compound pages of >= pageblock_order should consistenly be skipped until 240 + * Compound pages of >= pageblock_order should consistently be skipped until 241 241 * released. It is always pointless to compact pages of such order (if they are 242 242 * migratable), and the pageblocks they occupy cannot contain any free pages. 243 243 */