Skip to contentSkip to conversation

mm-mempolicy-make-mpol_to_str-robust-and-always-succeed.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 13, 2013

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: [merged] mm-mempolicy-make-mpol_to_str-robust-and-always-succeed.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 13 Nov 2013 12:38:15 -0800

The patch titled
Subject: mm, mempolicy: make mpol_to_str robust and always succeed
has been removed from the -mm tree. Its filename was
mm-mempolicy-make-mpol_to_str-robust-and-always-succeed.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: David Rientjes <[email protected]>
Subject: mm, mempolicy: make mpol_to_str robust and always succeed

mpol_to_str() should not fail. Currently, it either fails because the string buffer is too small or because a string hasn't been defined for a mempolicy mode.

If a new mempolicy mode is introduced and no string is defined for it, just warn and return "unknown".

If the buffer is too small, just truncate the string and return, the same behavior as snprintf().

This also fixes a bug where there was no NULL-byte termination when doing *p++ = '=' and *p++ ':' and maxlen has been reached.

Cc KOSAKI Motohiro <[email protected]>
Cc Chen Gang <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Dave Jones <[email protected]>

---

 fs/proc/task_mmu.c        |   14 ++++-----
 include/linux/mempolicy.h |    5 +--
 mm/mempolicy.c            |   54 +++++++++++-------------------------
 3 files changed, 25 insertions(+), 48 deletions(-)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~mm-mempolicy-make-mpol_to_str-robust-and-always-succeed +6 -8
diff -puN fs/proc/task_mmu.c~mm-mempolicy-make-mpol_to_str-robust-and-always-succeed fs/proc/task_mmu.c
@@ -1387,8 +1387,8 @@ static int show_numa_map(struct seq_file
 	struct mm_struct *mm = vma->vm_mm;
 	struct mm_walk walk = {};
 	struct mempolicy *pol;
-	int n;
-	char buffer[50];
+	char buffer[64];
+	int nid;
 
 	if (!mm)
 		return 0;
@@ -1404,10 +1404,8 @@ static int show_numa_map(struct seq_file
 	walk.mm = mm;
 
 	pol = get_vma_policy(task, vma, vma->vm_start);
-	n = mpol_to_str(buffer, sizeof(buffer), pol);
+	mpol_to_str(buffer, sizeof(buffer), pol);
 	mpol_cond_put(pol);
-	if (n < 0)
-		return n;
 
 	seq_printf(m, "%08lx %s", vma->vm_start, buffer);
 
@@ -1460,9 +1458,9 @@ static int show_numa_map(struct seq_file
 	if (md->writeback)
 		seq_printf(m, " writeback=%lu", md->writeback);
 
-	for_each_node_state(n, N_MEMORY)
-		if (md->node[n])
-			seq_printf(m, " N%d=%lu", n, md->node[n]);
+	for_each_node_state(nid, N_MEMORY)
+		if (md->node[nid])
+			seq_printf(m, " N%d=%lu", nid, md->node[nid]);
 out:
 	seq_putc(m, '\n');
 
include/linux/mempolicy.h renamed from include/linux/mempolicy.h~mm-mempolicy-make-mpol_to_str-robust-and-always-succeed +2 -3
diff -puN include/linux/mempolicy.h~mm-mempolicy-make-mpol_to_str-robust-and-always-succeed include/linux/mempolicy.h
@@ -169,7 +169,7 @@ int do_migrate_pages(struct mm_struct *m
 extern int mpol_parse_str(char *str, struct mempolicy **mpol);
 #endif
 
-extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
+extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
 
 /* Check if a vma is migratable */
 static inline int vma_migratable(struct vm_area_struct *vma)
@@ -307,9 +307,8 @@ static inline int mpol_parse_str(char *s
 }
 #endif
 
-static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
+static inline void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
 {
-	return 0;
 }
 
 static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
mm/mempolicy.c renamed from mm/mempolicy.c~mm-mempolicy-make-mpol_to_str-robust-and-always-succeed +17 -37

89 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are

origin.patch
x86-srat-use-numa_no_node.patch
linux-next.patch