Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3568006ioo; Mon, 30 May 2022 05:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypDBW46/4OufYfbB9WqiAzDH0tB8i4LIPoN/bLLWAnqzlktQ2daJ5BRklh/GWjCNpaWpod X-Received: by 2002:a05:6a00:2444:b0:4fd:db81:cbdd with SMTP id d4-20020a056a00244400b004fddb81cbddmr56978713pfj.32.1653912662689; Mon, 30 May 2022 05:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653912662; cv=none; d=google.com; s=arc-20160816; b=Lr4ACBpxb9zJA4nFWTkP5q6m5kxB/rk0Q/ICib65ZyWwSX8CGYAy1Dep1b3zn44qm6 7JW5QdJvkMC01G1ZALrVDW10EKgO7aVAmDDkJaynaDZ4jHnXAmw8TRDwiDNJfvo1aQmD 5tQIhWrJev7vsnyPf45uNclPoGuMXy3LmyI7Zd3O05IDZQMVKTM0HHtgLieskyK7sCL/ T3GHeI5KNUs5Ehxqd4CfHn6Xpo7F4ytXRAA3F1KL43MWdyqfdmC7hgTRlPLEW7k2dz9z G+gHflHDyMGFWb3FxMDruml2hfb1fjsP2h9mx2c3mw+f4+uLbhUAyXcSLkPG5qUzNkOe EM5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=1IjYCNOEe7iGECmm6shSmAFSNgKLU5OF1Uee8hObuEE=; b=DMqXcLFo9r6oqEsZoRn+1AaY4Zn3ErFVRLdFRaNQ9Ljw77UiaDIeU2Yg5KuP88iFRZ u3MoNRgynNEVQ8xjx3+My2TmTJgb7hD36IS90g6ioxHLmX5NYOfykVwqSRrCQkpBRFYv Y62SQIUvz7dD5bIll/kD9VM+lku6hkpKbyIcLj69YW9Q61/QoBvbw9xqp1cMiRSQbkC/ 6xYOj6a1qqamq+ctuYpLbbZOVkDsEc4VzW8SNXgwBePVaPUFPEngvtSOewp0C8LyBlRY mhm10D8koycuLpUZ84SXYzzruPbXgewwIB6rvdVgLzp0NboaIR8B/GLcj78sNPv/+Ggm 28OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a170902d4c700b0015cecd8602asi17310301plg.41.2022.05.30.05.10.48; Mon, 30 May 2022 05:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232894AbiE3IKF (ORCPT + 99 others); Mon, 30 May 2022 04:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbiE3IKD (ORCPT ); Mon, 30 May 2022 04:10:03 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD9F075205 for ; Mon, 30 May 2022 01:10:01 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-37-Q1IaZgzkNfy3MLvifs1jIQ-1; Mon, 30 May 2022 09:09:59 +0100 X-MC-Unique: Q1IaZgzkNfy3MLvifs1jIQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Mon, 30 May 2022 09:09:57 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.036; Mon, 30 May 2022 09:09:57 +0100 From: David Laight To: 'Yu-Jen Chang' , "ak@linux.intel.com" , "jdike@linux.intel.com" CC: "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "keescook@chromium.org" , "linux-kernel@vger.kernel.org" , "linux-hardening@vger.kernel.org" , "richard@nod.at" , "anton.ivanov@cambridgegreys.com" , "johannes@sipsolutions.net" , "linux-um@lists.infradead.org" , "jserv@ccns.ncku.edu.tw" Subject: RE: [PATCH 1/2] x86/lib: Optimize memchr() Thread-Topic: [PATCH 1/2] x86/lib: Optimize memchr() Thread-Index: AQHYcmroNJne+UgOCEK2wOYbJvL5k603Dq9w Date: Mon, 30 May 2022 08:09:57 +0000 Message-ID: <8b480c85f53c4f3b88bf99ba585e8768@AcuMS.aculab.com> References: <20220528081236.3020-1-arthurchang09@gmail.com> <20220528081236.3020-2-arthurchang09@gmail.com> In-Reply-To: <20220528081236.3020-2-arthurchang09@gmail.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RnJvbTogWXUtSmVuIENoYW5nDQo+IFNlbnQ6IDI4IE1heSAyMDIyIDA5OjEzDQo+IA0KPiBUaGUg b3JpZ2luYWwgYXNzZW1ibHkgdmVyc2lvbiBvZiBtZW1jaHIoKSBpcyBpbXBsZW1lbnRlZCB3aXRo DQo+IHRoZSBieXRlLXdpc2UgY29tcGFyaW5nIHRlY2huaXF1ZSwgd2hpY2ggZG9lcyBub3QgZnVs bHkNCj4gdXNlIDY0LWJpdHMgcmVnaXN0ZXJzIGluIHg4Nl82NCBDUFUuIFdlIHVzZSB3b3JkLXdp ZGUNCj4gY29tcGFyaW5nIHNvIHRoYXQgOCBjaGFyYWN0ZXJzIGNhbiBiZSBjb21wYXJlZCBhdCB0 aGUgc2FtZSB0aW1lDQo+IG9uIHg4Nl82NCBDUFUuIEZpcnN0IHdlIGFsaWduIHRoZSBpbnB1dCBh bmQgdGhlbiB1c2Ugd29yZC13aXNlDQo+IGNvbXBhcmluZyB0byBmaW5kIHRoZSBmaXJzdCA2NC1i aXQgd29yZCB0aGF0IGNvbnRhaW4gdGhlIHRhcmdldC4NCj4gU2Vjb25kbHksIHdlIGNvbXBhcmUg ZXZlcnkgYnl0ZSBpbiB0aGUgd29yZCBhbmQgZ2V0IHRoZSBvdXRwdXQuDQo+IA0KPiBXZSBjcmVh dGUgdHdvIGZpbGVzIHRvIG1lYXN1cmUgdGhlIHBlcmZvcm1hbmNlLiBUaGUgZmlyc3QgZmlsZQ0K PiBjb250YWlucyBvbi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