From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E610BC433B4 for ; Fri, 14 May 2021 18:40:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA5C26145B for ; Fri, 14 May 2021 18:40:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA5C26145B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IYQWY+V5Q86qUkX9r9WNNBHJVfelasHb+cWW8YodG1o=; b=meNN3YRqfWGBHGg1+2gnlU3Hp 3YAWVvhJ9tSTI61+M4x6fDRyWheCGs2pf1Igyk31fGVOWdJ4w/mYYOghMkjbTKafqDGLaF/dEW6CJ esmknZNBO0liCx0OVWXYLqDKsP5TmTTjvfs+MNuYQHPw1jkJ6aYXoARHlCY4anOTZIMu3zcVWRRHV 0JHCIWPnECDVFTgi/psfmFqU0nPDkN5wShaBDhN8LSNym8V/ouGUAb0sJoqNN3TMSDFitWqOzrznL 7X7/L3EiXTRcjYRTATHKOGkEOqzvAFKG8VkuYyRGwIXRwYA/4FGa7ZfPtP24KvTgjygaJwdUN6uUM kOf3X4SXQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhci3-008igU-NN; Fri, 14 May 2021 18:38:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhci1-008igH-5e for linux-arm-kernel@desiato.infradead.org; Fri, 14 May 2021 18:38:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=QXU6gsCZTO1hMK5uEKYcckPa2F93/nkAaayJfiMqNRM=; b=h3WMRMiGgtkJj8tcMeWIIT4qJi WxMVjw+0BJG2Hsqqur+1XXt60+8O27x1kuS5LBS0udkUlfR+9q5PlrQo+Bp+yupgsC5or3ypKiqsb IPC/0BJROz2ej++gO8VSkVpMJGW06INvtpAeaKuxPU2HzPgrRng1rRIWZVXlOOARaLJjomXsZbYLi TNkEYH1JLbhNQH/bXBz3TWI3D4lEUOawlJhhhJhWXWVzd6xBebUms8CJ4lO0T9qd7q1detZXfK4jI Piv1/vdmYVrpfuweluF+TgDZYnpUUSZ/hWO5ZBci557mJTPkiYjKlH8paliPxpYbqnRlTYN92fomZ Lpe0od9Q==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhchy-00CBQD-6B for linux-arm-kernel@lists.infradead.org; Fri, 14 May 2021 18:38:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D7AAB101E; Fri, 14 May 2021 11:38:38 -0700 (PDT) Received: from [10.57.66.179] (unknown [10.57.66.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E7353F718; Fri, 14 May 2021 11:38:37 -0700 (PDT) Subject: Re: [PATCH 7/8] arm64: Better optimised memchr() To: Catalin Marinas Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, yangyingliang@huawei.com References: <68d3229c208780fdde88ba48e14fcde8c50f6e76.1620738177.git.robin.murphy@arm.com> <20210514145513.GB28888@arm.com> From: Robin Murphy Message-ID: Date: Fri, 14 May 2021 19:38:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210514145513.GB28888@arm.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210514_113846_311485_BA096A3A X-CRM114-Status: GOOD ( 14.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-05-14 15:55, Catalin Marinas wrote: > On Tue, May 11, 2021 at 05:12:37PM +0100, Robin Murphy wrote: >> Although we implement our own assembly version of memchr(), it turns >> out to be barely any better than what GCC can generate for the generic >> C version (and would go wrong if the size_t argument were ever large >> enough to be interpreted as negative). Unfortunately we can't import the >> tuned implementation from the Arm optimized-routines library, since that >> has some Advanced SIMD parts which are not really viable for general >> kernel library code. What we can do, however, is pep things up with some >> relatively straightforward word-at-a-time logic for larger calls. >> >> Adding some timing to optimized-routines' memchr() test for a simple >> benchmark, overall this version comes in around half as fast as the SIMD >> code, but still nearly 4x faster than our existing implementation. >> >> Signed-off-by: Robin Murphy > > I haven't reviewed the code yet but wondering - could we write this in C > using load_unaligned_zeropad()? I've had a hack around with a couple of C implementations this afternoon, and they seem to come out roughly 85% as fast as this asm version. I'm not sure how much extra overhead load_unaligned_zeropad() would add with wiggling PSTATE.TCO all the time, though. Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel