mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [folded-merged] procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2.patch removed from -mm tree
@ 2018-02-08 20:31 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2018-02-08 20:31 UTC (permalink / raw)
  To: avagin, adobriyan, kamezawa.hiroyu, mm-commits


The patch titled
     Subject: procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2
has been removed from the -mm tree.  Its filename was
     procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2.patch

This patch was dropped because it was folded into procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps.patch

------------------------------------------------------
From: Andrei Vagin <avagin@openvz.org>
Subject: procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2

v2: don't create a separate function to print delimiter and a few fixes
to make code more readable.

Link: http://lkml.kernel.org/r/20180117082050.25406-1-avagin@openvz.org
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/seq_file.c |   57 +++++++++++++++++++++---------------------------
 1 file changed, 26 insertions(+), 31 deletions(-)

diff -puN fs/seq_file.c~procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2 fs/seq_file.c
--- a/fs/seq_file.c~procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2
+++ a/fs/seq_file.c
@@ -670,26 +670,6 @@ void seq_puts(struct seq_file *m, const
 }
 EXPORT_SYMBOL(seq_puts);
 
-static inline void seq_put_delimeter(struct seq_file *m, const char *delimiter)
-{
-	int len;
-
-	if (!delimiter || !delimiter[0])
-		return;
-
-	if (delimiter[1] == 0)
-		return seq_putc(m, delimiter[0]);
-
-	len = strlen(delimiter);
-	if (m->count + len >= m->size) {
-		seq_set_overflow(m);
-		return;
-	}
-
-	memcpy(m->buf + m->count, delimiter, len);
-	m->count += len;
-}
-
 /*
  * A helper routine for putting decimal numbers without rich format of printf().
  * only 'unsigned long long' is supported.
@@ -705,7 +685,12 @@ void seq_put_decimal_ull(struct seq_file
 	if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */
 		goto overflow;
 
-	seq_put_delimeter(m, delimiter);
+	len = strlen(delimiter);
+	if (m->count + len >= m->size)
+		goto overflow;
+
+	memcpy(m->buf + m->count, delimiter, len);
+	m->count += len;
 
 	if (m->count + 1 >= m->size)
 		goto overflow;
@@ -744,27 +729,32 @@ void seq_put_hex_ll(struct seq_file *m,
 {
 	int i, len;
 
-	seq_put_delimeter(m, delimiter);
-
-	len = (sizeof(v) * 8 - __builtin_clzll(v) + 3) / 4;
+	if (delimiter && delimiter[0]) {
+		if (delimiter[1] == 0)
+			seq_putc(m, delimiter[0]);
+		else
+			seq_puts(m, delimiter);
+	}
 
-	if (unlikely(len == 0))
+	/* If x is 0, the result of __builtin_clzll is undefined */
+	if (v == 0)
 		len = 1;
+	else
+		len = (sizeof(v) * 8 - __builtin_clzll(v) + 3) / 4;
 
 	if (len < width)
 		len = width;
 
-	if (m->count + len > m->size)
-		goto overflow;
+	if (m->count + len > m->size) {
+		seq_set_overflow(m);
+		return;
+	}
 
 	for (i = len - 1; i >= 0; i--) {
 		m->buf[m->count + i] = hex_asc[0xf & v];
 		v = v >> 4;
 	}
 	m->count += len;
-	return;
-overflow:
-	seq_set_overflow(m);
 }
 
 void seq_put_decimal_ll(struct seq_file *m, const char *delimiter, long long num)
@@ -774,7 +764,12 @@ void seq_put_decimal_ll(struct seq_file
 	if (m->count + 3 >= m->size) /* we'll write 2 bytes at least */
 		goto overflow;
 
-	seq_put_delimeter(m, delimiter);
+	len = strlen(delimiter);
+	if (m->count + len >= m->size)
+		goto overflow;
+
+	memcpy(m->buf + m->count, delimiter, len);
+	m->count += len;
 
 	if (m->count + 2 >= m->size)
 		goto overflow;
_

Patches currently in -mm which might be from avagin@openvz.org are

procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps.patch
procfs-optimize-seq_pad-to-speed-up-proc-pid-maps.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-08 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 20:31 [folded-merged] procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v2.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).