Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2020692imm; Sat, 28 Jul 2018 07:39:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfVgwH3hy5Bsyxkp66uBaaGn4rSRGPow1NsJ/QQ+aYtUXFIAZEifNIJjdzk+A1FauRU+fq2 X-Received: by 2002:a63:6a45:: with SMTP id f66-v6mr9753168pgc.81.1532788789410; Sat, 28 Jul 2018 07:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532788789; cv=none; d=google.com; s=arc-20160816; b=GSwsoXzloy4sWgLNj8yrxWJrbXSGdFR5BPYYTjMC6HsiN8A/XFn+euW5t6z85+KSi0 pauEwyQvgYzgnfgUIBnH73W8z8ByF90OGGuaW4pvQFGZ6JOCEhwdl3ggGf+p80kXJvWw mE4WDTMjbg3e8CXWL9X/ofLUasDeY2c9U4ON8/+7CwNDQLxx8LKdi1ViwpF7blF6g0Xu leHlaxEl31TzhA3VgMJ9CS85LEvihKFbFWTOeMSGHXrVK3lfVreDhtF61sD80p0tyaqx 3vi/yMkLiDv8n1aXIOaw09rIcOokFIFvqWgPMWe3+ib84UHhL5PUdsWSVQLfI5db4grK LdDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=6WReAxRXmxf3L4sT4AaB7+LORfwFSP+bticA7ta50PQ=; b=RyRYpZdbymSqzrPL3QdEI0J4KZC8v3+R5UszVNOvx6wanUsEiogPIx+RXQM2YpvwDx ar/qvf7o0sySei+TbN+2ZruJInz4h0ublvold8J/4u/OTtN+4Bj4M5u2eupREVg/6MD2 3D/cXLd3sQoKqm4iZsmqIYssQX4XEzXWDtC/bFWfIMD4GByGORY+0fFJY3P2x2QylC7W CnM74YIZFQIcEPPpSbnxCGzQ+YNeFYxQBsMuoinxwmHiE+DY95IH1k11hO4mWbqtKNhi rzNz0oka8D5emB4mK8J07Y1VnXpN2H3FJZHrnAsIQpun97JSjVe4auG5/TOqm5VVs/wM qu9w== ARC-Authentication-Results: i=1; mx.google.com; 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 z72-v6si6108223pgd.646.2018.07.28.07.39.33; Sat, 28 Jul 2018 07:39:49 -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; 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 S1729016AbeG1QF0 (ORCPT + 99 others); Sat, 28 Jul 2018 12:05:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33618 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728896AbeG1QF0 (ORCPT ); Sat, 28 Jul 2018 12:05:26 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0D421C75; Sat, 28 Jul 2018 14:38:41 +0000 (UTC) Date: Sat, 28 Jul 2018 16:38:38 +0200 From: Greg Kroah-Hartman To: Zhaoxiu Zeng Cc: Andy Shevchenko , Andrew Morton , Matthew Wilcox , Dan Carpenter , Geert Uytterhoeven , Thomas Gleixner , Andrey Ryabinin , Linux Kernel Mailing List , Zhaoxiu Zeng Subject: Re: [PATCH 1/1] lib: use sunday algorithm to do strstr() and strnstr() Message-ID: <20180728143838.GC3681@kroah.com> 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> <6b33eb08-b7f8-0104-4fe0-1c0f4cd5edfc@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6b33eb08-b7f8-0104-4fe0-1c0f4cd5edfc@163.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 写道: > >>> 在 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. Given that there doesn't seem to be a good reason to take your patch yet, that might be hard :) You need to convince us that the patch is a valid thing to accept, by writing a correct changelog and showing proof of its correctness as this is modifying a core function in the kernel. thanks, greg k-h