Skip to content

Commit eba4d77

Browse files
xzpeterakpm00
authored andcommitted
mm/swap: comment all the ifdef in swapops.h
swapops.h contains quite a few layers of ifdef, some of the "else" and "endif" doesn't get proper comment on the macro so it's hard to follow on what are they referring to. Add the comments. Link: https://lkml.kernel.org/r/20220811161331.37055-3-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Suggested-by: Nadav Amit <nadav.amit@gmail.com> Reviewed-by: Huang Ying <ying.huang@intel.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> Cc: Andi Kleen <andi.kleen@intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: "Kirill A . Shutemov" <kirill@shutemov.name> Cc: Minchan Kim <minchan@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 9c61d53 commit eba4d77

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/linux/swapops.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
247247
#ifdef CONFIG_HUGETLB_PAGE
248248
extern void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl);
249249
extern void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *pte);
250-
#endif
251-
#else
250+
#endif /* CONFIG_HUGETLB_PAGE */
251+
#else /* CONFIG_MIGRATION */
252252
static inline swp_entry_t make_readable_migration_entry(pgoff_t offset)
253253
{
254254
return swp_entry(0, 0);
@@ -276,7 +276,7 @@ static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
276276
#ifdef CONFIG_HUGETLB_PAGE
277277
static inline void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl) { }
278278
static inline void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *pte) { }
279-
#endif
279+
#endif /* CONFIG_HUGETLB_PAGE */
280280
static inline int is_writable_migration_entry(swp_entry_t entry)
281281
{
282282
return 0;
@@ -286,7 +286,7 @@ static inline int is_readable_migration_entry(swp_entry_t entry)
286286
return 0;
287287
}
288288

289-
#endif
289+
#endif /* CONFIG_MIGRATION */
290290

291291
typedef unsigned long pte_marker;
292292

@@ -426,7 +426,7 @@ static inline int is_pmd_migration_entry(pmd_t pmd)
426426
{
427427
return is_swap_pmd(pmd) && is_migration_entry(pmd_to_swp_entry(pmd));
428428
}
429-
#else
429+
#else /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
430430
static inline int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
431431
struct page *page)
432432
{
@@ -455,7 +455,7 @@ static inline int is_pmd_migration_entry(pmd_t pmd)
455455
{
456456
return 0;
457457
}
458-
#endif
458+
#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
459459

460460
#ifdef CONFIG_MEMORY_FAILURE
461461

@@ -490,7 +490,7 @@ static inline void num_poisoned_pages_sub(long i)
490490
atomic_long_sub(i, &num_poisoned_pages);
491491
}
492492

493-
#else
493+
#else /* CONFIG_MEMORY_FAILURE */
494494

495495
static inline swp_entry_t make_hwpoison_entry(struct page *page)
496496
{
@@ -509,7 +509,7 @@ static inline void num_poisoned_pages_inc(void)
509509
static inline void num_poisoned_pages_sub(long i)
510510
{
511511
}
512-
#endif
512+
#endif /* CONFIG_MEMORY_FAILURE */
513513

514514
static inline int non_swap_entry(swp_entry_t entry)
515515
{

0 commit comments

Comments
 (0)