Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp351969pxv; Thu, 22 Jul 2021 01:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJOIWnX0bk9skmrOQ2WX8dnpl4PK+di0A/Ca8OEpfzjqO113vccHzQGTy4eZvAU7T3pWVJ X-Received: by 2002:a17:906:bc84:: with SMTP id lv4mr41590263ejb.493.1626942692071; Thu, 22 Jul 2021 01:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626942692; cv=none; d=google.com; s=arc-20160816; b=v4VJCBhUZkxdv4jKFXyZ7EWgxFObj/jWMZrUDl2AL+nww/mJyNiSj1+vf4UcSsltvv FEZsavnS4rw4EoJMMvY1ZRv4MOd/iHm6vNT83A3MWGB/NaKrbNwMz+ortofDD9WUWEd3 mlsVu907wqlbOT5fGrHYJtWW5MMFIj37380uxzoQLEhhTR+eFnNv4zLGM1ilwnXHtmO/ 4U7ilbmwxpBg2qBMyeYjsQcwbT2JUhtreYjSq5iXpge5gP5LepxPQds7VYGsOW7jSZNn LXPKBuobK8RIlkJlJnrTF+XzQxqXSD3NaBHOZuPr69MSebqHI798PVclaZVUGNBts427 Pj7A== 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 :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=rJEk1owH52y6Qtju7I5k2CaWgV6Tg6KlHTHLAnNPcqk=; b=G0kId34nfaRv98b881VCsEHOzPgEuJR53al3v5NwdzwPH+Y+80hAAf2G+UlEuvWmPA 4iN1r0AhyB10KAeliotesl9nt8BVTd2D8JFw+SNvErRnCNoF6dUlo6MwQLBwEuqzHctH fOg4ySruz8ik+uzsZEb6OUCgcl4dA38o2Sdah4U0WiGQT3MRNtx1lLLRw9wGOaj8sRkc Uix0vDsRArT0gv3EO0Bg7Dhp5hpzfRR2saX8wFVglDIivD31ndnvB7/WgcTS5QItTB3V 3eeK6S//mTGqnym59YtwbjVfEWqMQ5OnETGvjOrIZRWi3gqA0isRSkrSmaizmJpadldr CrVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=P+21jWwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h23si4394777edr.51.2021.07.22.01.31.09; Thu, 22 Jul 2021 01:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=P+21jWwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbhGVHsY (ORCPT + 99 others); Thu, 22 Jul 2021 03:48:24 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:57386 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbhGVHsX (ORCPT ); Thu, 22 Jul 2021 03:48:23 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A126420394; Thu, 22 Jul 2021 08:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626942537; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rJEk1owH52y6Qtju7I5k2CaWgV6Tg6KlHTHLAnNPcqk=; b=P+21jWwHuJeX3oA7YjaxJga00O7zvBY5ysftiiH2+8rybxc8//yr4cf16a8EXLUpQTzUgQ bzJaN+NLzzACURhUqwAFSXCK3p8MP8At1CNhNxGKm64R0QEqzNQ0UbOJIFuAtXdM3z7l69 kb1QgfFQKjomIDnwkC1AyG9/v9T6WG8= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 5A0DF13889; Thu, 22 Jul 2021 08:28:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id K8gmEkks+WBcFwAAGKfGzw (envelope-from ); Thu, 22 Jul 2021 08:28:57 +0000 Subject: Re: [PATCH] lib/string: Bring optimized memcmp from glibc To: Linus Torvalds Cc: Linux Kernel Mailing List , Nick Desaulniers , linux-fsdevel , Dave Chinner References: <20210721135926.602840-1-nborisov@suse.com> From: Nikolay Borisov Message-ID: <80b4bbe8-2394-cfbb-ace1-9402169f5131@suse.com> Date: Thu, 22 Jul 2021 11:28:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.07.21 г. 21:45, Linus Torvalds wrote: > On Wed, Jul 21, 2021 at 11:17 AM Nikolay Borisov wrote: >> >> I find it somewhat arbitrary that we choose to align the 2nd pointer and >> not the first. > > Yeah, that's a bit odd, but I don't think it matters. > > The hope is obviously that they are mutually aligned, and in that case > it doesn't matter which one you aim to align. > >> So you are saying that the current memcmp could indeed use improvement >> but you don't want it to be based on the glibc's code due to the ugly >> misalignment handling? > > Yeah. I suspect that this (very simple) patch gives you the same > performance improvement that the glibc code does. You suspect correctly, perf profile: 30.44% -29.38% [kernel.vmlinux] [k] memcmp This is only on x86-64 as I don't have other arch handy. But this one is definitely good.