lib: memmove: Use optimised memcpy if possible
Subsystems (2)
PATCH 1/1 lib: memmove: Use optimised memcpy if possible
When there is no overlap between src and dst use optimised memcpy if it is available.
---
This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2.
This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do.
1. https://patchwork.linux-mips.org/patch/14517/
lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
lib/string.c +11 -0
@@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count)char *tmp;const char *s; +#ifdef __HAVE_ARCH_MEMCPY +/* Use optimised memcpy when there is no overlap */ +const char *s_end = src + count; +const char *d = dest; +char *d_end = dest + count; + + s = src; +if ((d_end <= s) || (s_end <= d)) +return memcpy (dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ +if (dest <= src) { tmp = dest; s = src;
Signature · 1 line
2.10.0
Quoted 43 lines · PrasannaKumar Muralidharan
When there is no overlap between src and dst use optimised memcpy if it is available.
Signed-off-by Paul Burton <[email protected]>Signed-off-by PrasannaKumar Muralidharan <[email protected]>---
This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2.This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do.
1. https://patchwork.linux-mips.org/patch/14517/
lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+)lib/string.c +11
-1@@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count)char *tmp;const char *s; +#ifdef __HAVE_ARCH_MEMCPY +/* Use optimised memcpy when there is no overlap */ +const char *s_end = src + count; +const char *d = dest; +char *d_end = dest + count; + + s = src; +if ((d_end <= s) || (s_end <= d)) +return memcpy (dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ +if (dest <= src) { tmp = dest; s = src; --
Quoted 2 lines
2.10.0
Is there anything more that I have to do for this patch? As there is no review comment I am wondering what I missed.
Thanks,
PrasannaKumar
Hi,
Quoted 43 lines · PrasannaKumar Muralidharan
When there is no overlap between src and dst use optimised memcpy if it is available.
Signed-off-by Paul Burton <[email protected]>Signed-off-by PrasannaKumar Muralidharan <[email protected]>---
This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2.This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do.
1. https://patchwork.linux-mips.org/patch/14517/
lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+)lib/string.c +11
-1@@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count)char *tmp;const char *s; +#ifdef __HAVE_ARCH_MEMCPY +/* Use optimised memcpy when there is no overlap */ +const char *s_end = src + count; +const char *d = dest; +char *d_end = dest + count; + + s = src; +if ((d_end <= s) || (s_end <= d)) +return memcpy (dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ +if (dest <= src) { tmp = dest; s = src; --
Quoted 2 lines
2.10.0
Is there anything more that I have to do for this patch?
Regards,
PrasannaKumar
Paul's original patch should have been separated into two patches to begin with. The patch does two different things and one part goes through the MIPS tree and one part goes through Andrew, probably.
Quoted 13 lines · PrasannaKumar Muralidharan
Hi,
Quoted 9 lines · PrasannaKumar Muralidharan
When there is no overlap between src and dst use optimised memcpy if it is available.
Signed-off-by Paul Burton <[email protected]>Signed-off-by PrasannaKumar Muralidharan <[email protected]>---
This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2.
Sign-off is like signing a legal document. Read Documentation/process/submitting-patches.rst the section about "11) Sign your work - the Developer's Certificate of Origin" for an explanation.
So, yeah, Paul provided his s-o-b and it needs to be here as well. But also he maybe should get authorship credit. Just put the first line in the email as:
From: Paul Burton <[email protected]>
But that's sort of a trickier thing, so maybe put some explanation that you chopped out a bit from Pauls patch in the changelog:
This is part of a patch that Paul Burton wrote https://patchwork.linux-mips.org/patch/14517/
I know you put that here, but since it's under the --- cut off it won't be saved in the final git log.
Quoted 6 lines
Quoted 6 lines
This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do.
Instead of boot testing, it would be better if we had a benchmark to show it helped speed things up.
Quoted 24 lines
Quoted 24 lines
1. https://patchwork.linux-mips.org/patch/14517/
lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+)lib/string.c +11
-0@@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count)char *tmp;const char *s; +#ifdef __HAVE_ARCH_MEMCPY +/* Use optimised memcpy when there is no overlap */ +const char *s_end = src + count; +const char *d = dest; +char *d_end = dest + count; + + s = src; +if ((d_end <= s) || (s_end <= d)) +return memcpy (dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ +
Quoted 9 lines
Quoted 6 lines
lib/string.c +0
-1if (dest <= src) { tmp = dest; s = src; --2.10.0
Is there anything more that I have to do for this patch?
Probably a patch like this needs to go through Andrew. Send it again and CC Andrew Morton <[email protected]>. It would be nice if we could CC a better list than LKML but I don't know which one... Few people read LKML.
regards,
dan carpenter
Hi Dan,
Quoted 3 lines · Dan Carpenter
Paul's original patch should have been separated into two patches to begin with. The patch does two different things and one part goes through the MIPS tree and one part goes through Andrew, probably.
Okay. I will split his patch into two and send with my modifications.
Quoted 27 lines · PrasannaKumar Muralidharan
Quoted 13 lines
Hi,
Quoted 9 lines · PrasannaKumar Muralidharan
When there is no overlap between src and dst use optimised memcpy if it is available.
Signed-off-by Paul Burton <[email protected]>Signed-off-by PrasannaKumar Muralidharan <[email protected]>---
This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2.Sign-off is like signing a legal document. Read
Documentation/process/submitting-patches.rstthe section about "11) Sign your work - the Developer's Certificate of Origin" for an explanation.So, yeah, Paul provided his s-o-b and it needs to be here as well. But also he maybe should get authorship credit. Just put the first line in the email as:
From: Paul Burton <[email protected]>
Quoted 8 lines
But that's sort of a trickier thing, so maybe put some explanation that you chopped out a bit from Pauls patch in the changelog:
This is part of a patch that Paul Burton wrote
https://patchwork.linux-mips.org/patch/14517/I know you put that here, but since it's under the --- cut off it won't be saved in the final git log.
Sure. Will do.
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do.
Instead of boot testing, it would be better if we had a benchmark to show it helped speed things up.
I will try to come up with some reasonable benchmark and post its results.
Quoted 34 lines
Quoted 24 lines
Quoted 24 lines
1. https://patchwork.linux-mips.org/patch/14517/
lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+)lib/string.c +11
-0@@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count)char *tmp;const char *s; +#ifdef __HAVE_ARCH_MEMCPY +/* Use optimised memcpy when there is no overlap */ +const char *s_end = src + count; +const char *d = dest; +char *d_end = dest + count; + + s = src; +if ((d_end <= s) || (s_end <= d)) +return memcpy (dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ +Quoted 9 lines
Quoted 6 lines
lib/string.c +0
-1if (dest <= src) { tmp = dest; s = src; --2.10.0
Is there anything more that I have to do for this patch?
Quoted 4 lines
Probably a patch like this needs to go through Andrew. Send it again and CC Andrew Morton <[email protected]>. It would be nice if we could CC a better list than LKML but I don't know which one... Few people read LKML.
I will add Andrew. Get maintainer script gave me a small list of email id for this. I don't know if there is a better way than using get_maintainer.pl.
Quoted 2 lines
regards,
dan carpenter
Thanks a lot for your time Dan.
Thanks,
PrasannaKumar