The patch titled Subject: proc: optimize single-symbol delimiters to spead up seq_put_decimal_ull has been added to the -mm tree. Its filename is proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrei Vagin <avagin@xxxxxxxxxx> Subject: proc: optimize single-symbol delimiters to spead up seq_put_decimal_ull A delimiter is a string which is printed before a number. A syngle-symbol delimiters can be printed by set_putc() and this works faster than printing by set_puts(). == test_proc.c int main(int argc, char **argv) { int n, i, fd; char buf[16384]; n = atoi(argv[1]); for (i = 0; i < n; i++) { fd = open(argv[2], O_RDONLY); if (fd < 0) return 1; if (read(fd, buf, sizeof(buf)) <= 0) return 1; close(fd); } return 0; } == $ time ./test_proc 1000000 /proc/1/stat == Before patch == real 0m3.820s user 0m0.337s sys 0m3.394s == After patch == real 0m3.110s user 0m0.324s sys 0m2.700s Link: http://lkml.kernel.org/r/20180212074931.7227-3-avagin@xxxxxxxxxx Signed-off-by: Andrei Vagin <avagin@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/seq_file.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff -puN fs/seq_file.c~proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull fs/seq_file.c --- a/fs/seq_file.c~proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull +++ a/fs/seq_file.c @@ -693,12 +693,12 @@ void seq_put_decimal_ull_width(struct se if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */ goto overflow; - len = strlen(delimiter); - if (m->count + len >= m->size) - goto overflow; - - memcpy(m->buf + m->count, delimiter, len); - m->count += len; + if (delimiter && delimiter[0]) { + if (delimiter[1] == 0) + seq_putc(m, delimiter[0]); + else + seq_puts(m, delimiter); + } if (!width) width = 1; @@ -782,12 +782,12 @@ void seq_put_decimal_ll(struct seq_file if (m->count + 3 >= m->size) /* we'll write 2 bytes at least */ goto overflow; - len = strlen(delimiter); - if (m->count + len >= m->size) - goto overflow; - - memcpy(m->buf + m->count, delimiter, len); - m->count += len; + if (delimiter && delimiter[0]) { + if (delimiter[1] == 0) + seq_putc(m, delimiter[0]); + else + seq_puts(m, delimiter); + } if (m->count + 2 >= m->size) goto overflow; _ Patches currently in -mm which might be from avagin@xxxxxxxxxx are procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps.patch procfs-add-seq_put_hex_ll-to-speed-up-proc-pid-maps-v3.patch procfs-optimize-seq_pad-to-speed-up-proc-pid-maps.patch proc-add-seq_put_decimal_ull_width-to-speed-up-proc-pid-smaps.patch proc-replace-seq_printf-on-seq_putc-to-speed-up-proc-pid-smaps.patch proc-optimize-single-symbol-delimiters-to-spead-up-seq_put_decimal_ull.patch proc-replace-seq_printf-by-seq_put_smth-to-speed-up-proc-pid-status.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html