Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1989847imm; Sat, 28 Jul 2018 07:04:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc23JNqwfwW/+CqUMJRc1L7Zt9FNtBu70Q+uGO7YwLcz6tlrt0k28uwDvPrxA4nZaAADlBJ X-Received: by 2002:a17:902:8a94:: with SMTP id p20-v6mr9781797plo.258.1532786677833; Sat, 28 Jul 2018 07:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532786677; cv=none; d=google.com; s=arc-20160816; b=kj/olXTuNKes3U7TEqTSyxhpfopCyYJByZ4bHNzGDYSYyBVqlzF4JQ8u3JRIm1/6AM nJoUsItG1Fx9JKvsUp2dB1BDlJ3rIfw0ttGDsJmtyir0+8fLlwx6pIz6Xq+gQGtMgCjP WLVslB/PMf2Nq6N5VE8PuT7hYIFV5Ix2HUW4clcF+n2URbG/9RozcfZOYTG98kvKTcf4 qQ93h6JmdubLfBm8R1JFJWKy7XfGndEB0XcDq19kjHmnsSUXno2+XKMIcK11mQEmDBRm HthIg4HcUMMjipwA7LSfUz0xqzk2M5YsIbTrcUalcGvUpb2NjUsPU02AdtYrKgMwytJz 3VNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=3MYvqsG3cWz4bbMpteDqxdJyroApbFouTWsj6nMLLqY=; b=NmTdkPSZAxb52RvRg5pL4Ko2qVjiG2K8bm2Pa40206/lvzwuHtN5b6X9joMj2sjY92 yO3Jdr8nzbZeqgTZ3tJl2NlcPVdO0s0eVyHUaLbVQPKWBxE+UVlIuZcHfqHrkCqP2mFQ 0lEDuAamK6bBxnZEqJ9jHBSsnFuoTKu1qXo2DAo6LbvW0lMQGlVW1Hnb3fclottG7chH 4su9dxfYbiQEDEIVuFdDGXaon1AmSJNQnwRUZ8URpa/HNHc/4BsC+0iXhgg1AqCfCHmH jwNFV29Ej1rILeZ1EQgJ803P4pHjf3wWIedtPdI1pMEpTBYMCl0Otcu6Culj4YS7Zx70 Shww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=BjpRxqub; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f27-v6si6648156pgb.302.2018.07.28.07.04.22; Sat, 28 Jul 2018 07:04:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=BjpRxqub; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbeG1PaN (ORCPT + 99 others); Sat, 28 Jul 2018 11:30:13 -0400 Received: from m12-18.163.com ([220.181.12.18]:58029 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728780AbeG1PaN (ORCPT ); Sat, 28 Jul 2018 11:30:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=3MYvq sG3cWz4bbMpteDqxdJyroApbFouTWsj6nMLLqY=; b=BjpRxqubFU0t+LdoN8rAd TjnBWuvDWE4Kh4RLcDYLvlU6TI1LsXxW+ooh+cggWtZU8jJGs2AwdskDQ06l+sgl GvKnMht86FR7wiNeW7Xslm5wNiD3R6ZnKzVvtu4jYUhXf4NyJDQCRAwSRoObO5Wz MnnRqRhXuBOvnR5bgVbEUY= Received: from [192.168.0.103] (unknown [223.73.7.251]) by smtp14 (Coremail) with SMTP id EsCowABHpR2Kd1xbVv61Mw--.63351S3; Sat, 28 Jul 2018 22:02:52 +0800 (CST) Subject: Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr() To: Andy Shevchenko Cc: Greg Kroah-Hartman , Andrew Morton , Matthew Wilcox , Dan Carpenter , Geert Uytterhoeven , Thomas Gleixner , Andrey Ryabinin , Linux Kernel Mailing List , Zhaoxiu Zeng References: <20180722173715.25327-1-zengzhaoxiu@163.com> <20180722183706.GA7979@kroah.com> <9b18802b-a451-eb81-3317-1de406f03118@163.com> <6dc928cd-adbb-0304-1308-fb556d48698d@163.com> From: Zhaoxiu Zeng Message-ID: <6b33eb08-b7f8-0104-4fe0-1c0f4cd5edfc@163.com> Date: Sat, 28 Jul 2018 22:02:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EsCowABHpR2Kd1xbVv61Mw--.63351S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrKr48Kw13Kr1DuFWxtr1DJrb_yoW8JrWxpF Wvva1rKF4DJay2yr1vkrn7XF4Yy3sakrykXry5Xwnaywn0qFn8Kr4xtrWj9F1kurn2kw1S yFWDt3yUZF1DXaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jiuc_UUUUU= X-Originating-IP: [223.73.7.251] X-CM-SenderInfo: p2hqw6xkdr5xrx6rljoofrz/1tbiow6RgFUMGqqqlwAAso Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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: > >>>>> 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 >>>> >>>> So you say, but what does this really buy us? Why make this change? >>>> How was it tested? What is the downside of not taking this? > >>> I use the following program to test on fc28. >>> Compile with O2, the new version is almost 2X faster than the original. > >>> The code size of the original is 0x80, the newer is 0xB0. > > So, output of bloat-o-meter would be good to have in commit message. > >>> The test result: > > Compact performance statistics as well. > >>> Thanks! > >> The original strnstr might has a bug too! >> For example, assume s1 is "123\0abc...." and s2 is "abc\0", >> call strnstr(s1, s2, 7) will return &s1[4], but the correct result is NULL. > > If there is a bug, send another patch to fix the bug first. > The bug could be fixed by this patch.