Skip to contentSkip to conversation

mips: fix comment about pgtable_init()

PATCH Superseded Mike Rapoport 2 participants 3 messages Mar 21, 2023 – Mar 22, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/14 mips: fix comment about pgtable_init()

From: "Mike Rapoport (IBM)" <[email protected]>

Comment about fixrange_init() says that its called from pgtable_init() while the actual caller is pagetabe_init().

Update comment to match the code.

---
 arch/mips/include/asm/fixmap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/fixmap.h +1 -1
index beea14761cef..b037718d7e8b 100644
@@ -70,7 +70,7 @@ enum fixed_addresses {
 #include <asm-generic/fixmap.h>
 
 /*
- * Called from pgtable_init()
+ * Called from pagetable_init()
  */
 extern void fixrange_init(unsigned long start, unsigned long end,
 	pgd_t *pgd_base);
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 2/14 mm/page_alloc: add helper for checking if check_pages_enabled

From: "Mike Rapoport (IBM)" <[email protected]>

Instead of duplicating long static_branch_enabled(&check_pages_enabled) wrap it in a helper function is_check_pages_enabled()

---
 mm/page_alloc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
mm/page_alloc.c +8 -3
index 87d760236dba..e1149d54d738 100644
@@ -245,6 +245,11 @@ EXPORT_SYMBOL(init_on_free);
 /* perform sanity checks on struct pages being allocated or freed */
 static DEFINE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled);
 
+static inline bool is_check_pages_enabled(void)
+{
+	return static_branch_unlikely(&check_pages_enabled);
+}
+
 static bool _init_on_alloc_enabled_early __read_mostly
 				= IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON);
 static int __init early_init_on_alloc(char *buf)
@@ -1443,7 +1448,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
 		for (i = 1; i < (1 << order); i++) {
 			if (compound)
 				bad += free_tail_pages_check(page, page + i);
-			if (static_branch_unlikely(&check_pages_enabled)) {
+			if (is_check_pages_enabled()) {
 				if (unlikely(free_page_is_bad(page + i))) {
 					bad++;
 					continue;
@@ -1456,7 +1461,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
 		page->mapping = NULL;
 	if (memcg_kmem_online() && PageMemcgKmem(page))
 		__memcg_kmem_uncharge_page(page, order);
-	if (static_branch_unlikely(&check_pages_enabled)) {
+	if (is_check_pages_enabled()) {
 		if (free_page_is_bad(page))
 			bad++;
 		if (bad)
@@ -2366,7 +2371,7 @@ static int check_new_page(struct page *page)
 
 static inline bool check_new_pages(struct page *page, unsigned int order)
 {
-	if (static_branch_unlikely(&check_pages_enabled)) {
+	if (is_check_pages_enabled()) {
 		for (int i = 0; i < (1 << order); i++) {
 			struct page *p = page + i;
 
Signature · 1 line
2.35.1
Reviewed-by on v2 1/14
#2 lore raw
In reply to Mike Rapoport
Quoted 18 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

Comment about fixrange_init() says that its called from pgtable_init() while the actual caller is pagetabe_init().

Update comment to match the code.

---
  arch/mips/include/asm/fixmap.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/fixmap.h +0 -0
index beea14761cef..b037718d7e8b 100644

arch/mips/include/asm/fixmap.h enum fixed_addresses { · line 73

Quoted 5 lines
arch/mips/include/asm/fixmap.h +1 -1
@@ -70,7 +70,7 @@ enum fixed_addresses {
  #include <asm-generic/fixmap.h>
 
  /*
- * Called from pgtable_init()
+ * Called from pagetable_init()

I'm not sure about the usefulness of this comment; I suppose it predates git-grep. Anyhow,

Quoted 3 lines
arch/mips/include/asm/fixmap.h +0 -0
   */
  extern void fixrange_init(unsigned long start, unsigned long end,
  	pgd_t *pgd_base);