Re: [PATCH 1/3] lib: Introduce copy_from_back()

2020-11-18 Thread Zhaoxiu Zeng
在 2020/11/17 1:24, Christoph Hellwig 写道: >> +#define FAST_COPY_SAFEGUARD_SIZE (sizeof(long) * 2 - 1) >> + >> +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS >> + >> +/* >> + * The caller must ensure that the output buffer has enough space (len + >> FAST_COPY_SAFEGUARD_SIZE), >> + * so we can write

Re: [PATCH 1/3] lib: Introduce copy_from_back()

2020-11-16 Thread Zhaoxiu Zeng
在 2020/11/17 0:35, Christoph Hellwig 写道: > On Tue, Nov 10, 2020 at 03:16:01AM +0800, zengzhao...@163.com wrote: >> From: Zhaoxiu Zeng >> >> Copying the matched bytes from the back output buffer is the >> key code of the LZ decompression algorithm which used by zlib,

Re: [lib] 6ee736dc92: BUG:unable_to_handle_page_fault_for_address

2020-11-16 Thread Zhaoxiu Zeng
5.134783] ---[ end trace a0a85397603c3dac ]--- > > > To reproduce: > > git clone https://github.com/intel/lkp-tests.git > cd lkp-tests > bin/lkp install job.yaml # job file is attached in this email > bin/lkp run job.yaml > > >

Re: [PATCH 2/3] lib: zlib_inflate: improves decompression performance

2020-11-11 Thread Zhaoxiu Zeng
在 2020/11/11 11:46, Jann Horn 写道: > On Mon, Nov 9, 2020 at 8:27 PM wrote: >> This patch does: >> 1. Cleanup code and reduce branches >> 2. Use copy_from_back to copy the matched bytes from the back output buffer > > What exactly is copy_from_back()? Is it like memmove()? If yes, have > you tried

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-29 Thread Zhaoxiu Zeng
在 2018/7/28 22:38, Greg Kroah-Hartman 写道: > On Sat, Jul 28, 2018 at 10:02:51PM +0800, Zhaoxiu Zeng wrote: >> 在 2018/7/27 18:39, Andy Shevchenko 写道: >>> On Fri, Jul 27, 2018 at 8:48 AM, Zhaoxiu Zeng wrote: >>>> 在 2018/7/27 1:17, Zhaoxiu Zeng 写道: >>>>

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-29 Thread Zhaoxiu Zeng
在 2018/7/28 22:38, Greg Kroah-Hartman 写道: > On Sat, Jul 28, 2018 at 10:02:51PM +0800, Zhaoxiu Zeng wrote: >> 在 2018/7/27 18:39, Andy Shevchenko 写道: >>> On Fri, Jul 27, 2018 at 8:48 AM, Zhaoxiu Zeng wrote: >>>> 在 2018/7/27 1:17, Zhaoxiu Zeng 写道: >>>>

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-28 Thread Zhaoxiu Zeng
在 2018/7/27 18:39, Andy Shevchenko 写道: > On Fri, Jul 27, 2018 at 8:48 AM, Zhaoxiu Zeng wrote: >> 在 2018/7/27 1:17, Zhaoxiu Zeng 写道: >>> 在 2018/7/23 2:37, Greg Kroah-Hartman 写道: >>>> On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: > >>>>&

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-28 Thread Zhaoxiu Zeng
在 2018/7/27 18:39, Andy Shevchenko 写道: > On Fri, Jul 27, 2018 at 8:48 AM, Zhaoxiu Zeng wrote: >> 在 2018/7/27 1:17, Zhaoxiu Zeng 写道: >>> 在 2018/7/23 2:37, Greg Kroah-Hartman 写道: >>>> On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: > >>>>&

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-27 Thread Zhaoxiu Zeng
在 2018/7/27 1:17, Zhaoxiu Zeng 写道: > 在 2018/7/23 2:37, Greg Kroah-Hartman 写道: >> On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: >>> From: Zhaoxiu Zeng >>> >>> The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy >&g

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-27 Thread Zhaoxiu Zeng
在 2018/7/27 1:17, Zhaoxiu Zeng 写道: > 在 2018/7/23 2:37, Greg Kroah-Hartman 写道: >> On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: >>> From: Zhaoxiu Zeng >>> >>> The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy >&g

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-26 Thread Zhaoxiu Zeng
在 2018/7/23 2:37, Greg Kroah-Hartman 写道: > On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: >> From: Zhaoxiu Zeng >> >> The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy and >> fast. >> For the Sunday algorithm, to see >&

Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-26 Thread Zhaoxiu Zeng
在 2018/7/23 2:37, Greg Kroah-Hartman 写道: > On Mon, Jul 23, 2018 at 01:37:15AM +0800, Zhaoxiu Zeng wrote: >> From: Zhaoxiu Zeng >> >> The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy and >> fast. >> For the Sunday algorithm, to see >&

[PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-22 Thread Zhaoxiu Zeng
From: Zhaoxiu Zeng The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy and fast. For the Sunday algorithm, to see http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/sundayen.htm Signed-off-by: Zhaoxiu Zeng --- lib/string.c | 92

[PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr()

2018-07-22 Thread Zhaoxiu Zeng
From: Zhaoxiu Zeng The Sunday algorithm is a variation of Boyer-Moore algorithm, it is easy and fast. For the Sunday algorithm, to see http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/sundayen.htm Signed-off-by: Zhaoxiu Zeng --- lib/string.c | 92

Re: [PATCH 2/2] lib: kstrtox: _parse_integer: use hex_to_bin instead local conversion, and reduce branches

2016-06-30 Thread Zhaoxiu Zeng
On 2016/6/30 6:06, Alexey Dobriyan wrote: > On Thu, Jun 30, 2016 at 12:22:13AM +0800, zengzhao...@163.com wrote: >> --- a/lib/kstrtox.c >> +++ b/lib/kstrtox.c >> @@ -48,38 +48,26 @@ unsigned int _parse_integer(const char *s, unsigned int >> base, unsigned long long >> { >> unsigned long

Re: [PATCH 2/2] lib: kstrtox: _parse_integer: use hex_to_bin instead local conversion, and reduce branches

2016-06-30 Thread Zhaoxiu Zeng
On 2016/6/30 6:06, Alexey Dobriyan wrote: > On Thu, Jun 30, 2016 at 12:22:13AM +0800, zengzhao...@163.com wrote: >> --- a/lib/kstrtox.c >> +++ b/lib/kstrtox.c >> @@ -48,38 +48,26 @@ unsigned int _parse_integer(const char *s, unsigned int >> base, unsigned long long >> { >> unsigned long

Re: [PATCH 1/2] lib: hexdump: use a look-up table to do hex_to_bin

2016-06-30 Thread Zhaoxiu Zeng
On 2016/6/30 2:31, Michal Nazarewicz wrote: > On Thu, Jun 30 2016, zengzhaoxiu wrote: ... >> So this replaces table lookup in tolower with an explicit table lookup >> here while also removing some branches. >> >> Is that an improvement? Hard to say. _ctype table is used by all the >> other

Re: [PATCH 1/2] lib: hexdump: use a look-up table to do hex_to_bin

2016-06-30 Thread Zhaoxiu Zeng
On 2016/6/30 2:31, Michal Nazarewicz wrote: > On Thu, Jun 30 2016, zengzhaoxiu wrote: ... >> So this replaces table lookup in tolower with an explicit table lookup >> here while also removing some branches. >> >> Is that an improvement? Hard to say. _ctype table is used by all the >> other

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Zhaoxiu Zeng
On 2016/5/11 17:31, Peter Zijlstra wrote: > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. Setpo is better. In most cases, we need to store the parity, or compare it with other variables. For example, in drivers/net/ethernet/broadcom/tg3.c, static int

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Zhaoxiu Zeng
On 2016/5/11 17:31, Peter Zijlstra wrote: > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. Setpo is better. In most cases, we need to store the parity, or compare it with other variables. For example, in drivers/net/ethernet/broadcom/tg3.c, static int

Re: [patch V4] lib: GCD: Use binary GCD algorithm instead of Euclidean

2016-05-08 Thread Zhaoxiu Zeng
在 2016/5/7 16:41, George Spelvin 写道: > Nothing critical, but a bit of kibitzing. > (That is slang in the Yiddish language for a person > who offers annoying and unwanted advice.) > >> The binary GCD algorithm is based on the following facts: >> 1. If a and b are all evens, then gcd(a,b) = 2 *

Re: [patch V4] lib: GCD: Use binary GCD algorithm instead of Euclidean

2016-05-08 Thread Zhaoxiu Zeng
在 2016/5/7 16:41, George Spelvin 写道: > Nothing critical, but a bit of kibitzing. > (That is slang in the Yiddish language for a person > who offers annoying and unwanted advice.) > >> The binary GCD algorithm is based on the following facts: >> 1. If a and b are all evens, then gcd(a,b) = 2 *

Re: [PATCH V3] blackfin: optimize ffz, __ffs, ffs, __fls, and fls functions

2016-04-15 Thread Zhaoxiu Zeng
在 2016/4/16 0:08, Joe Perches 写道: > On Fri, 2016-04-15 at 23:20 +0800, zengzhao...@163.com wrote: >> From: Zeng Zhaoxiu >> >> blackfin has popcount instruction (ONES), we can do the efficient >> computing (ffz, __ffs, ffs, __fls, and fls) use this instruction. > [] >> diff

Re: [PATCH V3] blackfin: optimize ffz, __ffs, ffs, __fls, and fls functions

2016-04-15 Thread Zhaoxiu Zeng
在 2016/4/16 0:08, Joe Perches 写道: > On Fri, 2016-04-15 at 23:20 +0800, zengzhao...@163.com wrote: >> From: Zeng Zhaoxiu >> >> blackfin has popcount instruction (ONES), we can do the efficient >> computing (ffz, __ffs, ffs, __fls, and fls) use this instruction. > [] >> diff --git

[PATCH 01/31] bitops: add parity functions

2016-03-23 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu When I do "grep parity -r linux", I found many parity calculations distributed in many drivers. These patches provide generic and architecture-specific parity calculations. Signed-off-by: Zeng Zhaoxiu ---

[PATCH 01/31] bitops: add parity functions

2016-03-23 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu When I do "grep parity -r linux", I found many parity calculations distributed in many drivers. These patches provide generic and architecture-specific parity calculations. Signed-off-by: Zeng Zhaoxiu --- include/asm-generic/bitops.h | 1 +

[PATCH 05/10] exynos4-is: Replace "hweight32(mask) == 1" with "is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/media/platform/exynos4-is/fimc-is-regs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c b/drivers/media/platform/exynos4-is/fimc-is-regs.c index cfe4406..ec75a24

[PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/hwspinlock/omap_hwspinlock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index ad2f8ca..1848a4c 100644 ---

[PATCH 03/10] i915: Replace "hweight8(dev_priv->info.subslice_7eu[i]) != 1" with "!is_power_of_2(dev_priv->info.subslice_7eu[i])"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/gpu/drm/i915/intel_ringbuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 9461a23..16c8cf1 100644 ---

[PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/bus/brcmstb_gisb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index f364fa4..2816a04 100644 --- a/drivers/bus/brcmstb_gisb.c +++

[PATCH 01/10] sh: Replace "hweight_long(flags) != 1" with "!is_power_of_2(flags)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- arch/sh/kernel/io_trapped.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c index f8ce362..d8f32bf 100644 --- a/arch/sh/kernel/io_trapped.c +++

[PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/hwspinlock/omap_hwspinlock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index

[PATCH 05/10] exynos4-is: Replace "hweight32(mask) == 1" with "is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/media/platform/exynos4-is/fimc-is-regs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c

[PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/bus/brcmstb_gisb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index f364fa4..2816a04 100644 ---

[PATCH 03/10] i915: Replace "hweight8(dev_priv->info.subslice_7eu[i]) != 1" with "!is_power_of_2(dev_priv->info.subslice_7eu[i])"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/gpu/drm/i915/intel_ringbuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c

[PATCH 01/10] sh: Replace "hweight_long(flags) != 1" with "!is_power_of_2(flags)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- arch/sh/kernel/io_trapped.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c index f8ce362..d8f32bf 100644 ---

[PATCH 1/1] div64: Speedup generic version

2014-08-17 Thread Zhaoxiu Zeng
The new version do few 64 bits operations. When high 32 bits of dividend becomes 0, use 32 bits division directly. Signed-off-by: Zhaoxiu Zeng --- lib/div64.c | 63 + 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/lib

[PATCH 1/1] div64: Speedup generic version

2014-08-17 Thread Zhaoxiu Zeng
The new version do few 64 bits operations. When high 32 bits of dividend becomes 0, use 32 bits division directly. Signed-off-by: Zhaoxiu Zeng zhaoxiu.z...@gmail.com --- lib/div64.c | 63 + 1 file changed, 43 insertions(+), 20 deletions

[PATCH 1/1] GCD: add binary GCD algorithm

2014-08-15 Thread Zhaoxiu Zeng
Because some architectures (alpha, armv6, etc.) don't provide hardware division, the mod operation is slow! Binary GCD algorithm uses simple arithmetic operations, it replaces division with arithmetic shifts, comparisons, and subtraction. Signed-off-by: Zhaoxiu Zeng --- lib/Kconfig | 15

[PATCH 1/1] GCD: add binary GCD algorithm

2014-08-15 Thread Zhaoxiu Zeng
Because some architectures (alpha, armv6, etc.) don't provide hardware division, the mod operation is slow! Binary GCD algorithm uses simple arithmetic operations, it replaces division with arithmetic shifts, comparisons, and subtraction. Signed-off-by: Zhaoxiu Zeng zhaoxiu.z...@gmail.com