[RFC PATCH 09/11] mm/mempolicy: build mpol_parse_str unconditionally

From: Gregory Price
Date: Wed Nov 22 2023 - 16:13:03 EST


mpol_parse_str is conditioned on CONFIG_TMPFS. We intend to reuse
this interface for procfs/mempolicy, so build unconditionally.

Signed-off-by: Gregory Price <gregory.price@xxxxxxxxxxxx>
---
include/linux/mempolicy.h | 4 ----
mm/mempolicy.c | 2 --
2 files changed, 6 deletions(-)

diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index b951e96a53ce..1adbcc10f291 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -158,9 +158,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
const nodemask_t *to, int flags);


-#ifdef CONFIG_TMPFS
extern int mpol_parse_str(char *str, struct mempolicy **mpol);
-#endif

extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);

@@ -276,12 +274,10 @@ static inline void check_highest_zone(int k)
{
}

-#ifdef CONFIG_TMPFS
static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
{
return 1; /* error */
}
-#endif

static inline int mpol_misplaced(struct folio *folio,
struct vm_area_struct *vma,
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e0c9127571dd..a418af0a1359 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3115,7 +3115,6 @@ static const char * const policy_modes[] =
[MPOL_PREFERRED_MANY] = "prefer (many)",
};

-#ifdef CONFIG_TMPFS
/**
* mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.
* @str: string containing mempolicy to parse
@@ -3248,7 +3247,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
*mpol = new;
return err;
}
-#endif /* CONFIG_TMPFS */

/**
* mpol_to_str - format a mempolicy structure for printing
--
2.39.1