Received: by 10.223.176.46 with SMTP id f43csp1054680wra; Wed, 24 Jan 2018 09:53:25 -0800 (PST) X-Google-Smtp-Source: AH8x225CTtP05Y+EGLkFRzW3axdORXFOs7ssyvjEMEDN4HvBYnB2wzy3noWCqvSdzwLn/2jLUUwY X-Received: by 2002:a17:902:904b:: with SMTP id w11-v6mr8902081plz.41.1516816405200; Wed, 24 Jan 2018 09:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516816405; cv=none; d=google.com; s=arc-20160816; b=SqNn348eZ0/sRAhYFXf+hftFK27X6W9Pmln7/w3gyyce702OkszV3uPpiT1+kOmonx 7ZP2WXU4xMkrR8XDdjvnslNkQ0bSV/8wiVAbZHIrHVblKtlxOv4X/EyjpiwpykrvnngN QeeiKnLFHUqCsGAMEr9kK+vwjI3aO/iuooFBPve7cBhGwDfmzB7b8/g0NOqboYJvX5rf r0JbIqitcHlWAi0NO1NHu/W2zFH9C+4c4dTK42w5dHOl89tlh/UeOQCP7CuK1aXDNmiD XJPcbrbdsE3v9hQPqQAcCzyrm8kzCCmJqbO6e+LakM+R4UgcntpHQMPQ12rjTd9OMKJW TS6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=kQgV1eLJD0QR0x8+GEVi0HNFuULnPDZOaxmc+36OrRo=; b=PcmyHzImOqGgwMJa9XnG+CqBXRVPgaRpdyrErS52daM68ADgK1Rn3FlUc67X1Fl+qa Xt+2itNoMksPvoxWH8HDl5pl3Ua3ByTnloSO74XFLTpAt9koHdUYUNB9YQMGkEzOqEYP NNPIB0V9LTBVuZXINCuUtRal5tLvoLOBeuXXslCPiXEVF6fVCsRs9rjbK8e3u9lJQy+S BtQPd7Nh3c1dY+EZUmukN67Dpi6G89X/5Cl+MYxhHkFeAm47YmMcz7nQkjobzZfd5NW0 WgEN1mWUyzP0umrlRGIOJD/faCWcfPO+Sxjqu2L4TAYaUA3ohanFyRsPBKfQJHl/0wMT 8f0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=A8l2AgAm; 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 r1si387331pgp.603.2018.01.24.09.53.10; Wed, 24 Jan 2018 09:53:25 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=A8l2AgAm; 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 S964992AbeAXRwr (ORCPT + 99 others); Wed, 24 Jan 2018 12:52:47 -0500 Received: from mail-it0-f49.google.com ([209.85.214.49]:40228 "EHLO mail-it0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964826AbeAXRwn (ORCPT ); Wed, 24 Jan 2018 12:52:43 -0500 Received: by mail-it0-f49.google.com with SMTP id 196so6137396iti.5; Wed, 24 Jan 2018 09:52:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kQgV1eLJD0QR0x8+GEVi0HNFuULnPDZOaxmc+36OrRo=; b=A8l2AgAm9xBTGiruiwUy7NvKd6d/TN0thkU4AcZEAhYR4xlEFPxtgJVVL4p7zGFqMP BkRHPSb8idNUISYcsMxD1p/MiGMvo8fr29A4nqq8aSV4YEsVNdtfTF2FfHjem5gG6uos blKtjtxJDNO26dT228z+b3sHqGXWDNfh5U0ndgajzbsf//fCfK2nduM+RKxaYJBa6aC8 YNgrBTmjOEQSnd6/dZR6iPjFxWzou9ETIKFQomIW+2Il30z3NxhoyGw5WaUbB1WDZCDg AK3UgK8zZPr4QsihBHIH7pcKeQoZZ/biRGJG3C0f1GZ659SuCJ+hryMnaHWLll0BR/Ju ne6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kQgV1eLJD0QR0x8+GEVi0HNFuULnPDZOaxmc+36OrRo=; b=cJK4/j8ZnNWJb6JFh00naIrqbPPJKa+wh4eN3ddooRbPDv46NdX+eqEZBdA6LVYnk0 SlDQickCi+uuDo8SF1beDf+1u1Ub85NDJbiYonWu+PE7+1ds8QstLw71Uas3VIG5lsSu 9cg0xOg4ewA6nGt13xodebfdVZouoeMA5Y9WZ2x8gL9ZkI6yiLute4BtUsP6ReXfbNM1 6Z53FFMUW5NMaNKf+P24+txnjwNGX1AQoPkzPSQjeRzsS4Rn+NBKtn9z+EEM5Cgdoccc cxtxjY6mvIWPC1vv097IwPUY1OJtdovLCd2OH0ccBm3l1NASYcCIMnBM5NKvqkJdvSVk 9S7w== X-Gm-Message-State: AKwxytdChr3Am0+zhDOSeYpUOVJswDnougkKpjNJQmkbg18LQfz60dj2 bbyEZXX7xlc8Vdj2TzALwGzmb+Lpat4ZaC8BACY= X-Received: by 10.36.248.134 with SMTP id a128mr9491195ith.152.1516816363002; Wed, 24 Jan 2018 09:52:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.196 with HTTP; Wed, 24 Jan 2018 09:52:42 -0800 (PST) In-Reply-To: References: <20180109163745.3692-1-aryabinin@virtuozzo.com> <50fcfba8-fc16-b4a1-d117-24ebbe959c0c@virtuozzo.com> From: Linus Torvalds Date: Wed, 24 Jan 2018 09:52:42 -0800 X-Google-Sender-Auth: aC_mWmiaXodV-5GtWc5nWFh-H7M Message-ID: Subject: Re: [PATCH] lib/strscpy: remove word-at-a-time optimization. To: Rasmus Villemoes Cc: Andrey Ryabinin , Andrew Morton , Linux Kernel Mailing List , Kees Cook , Eryu Guan , Alexander Potapenko , Chris Metcalf , David Laight , Dmitry Vyukov , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 12:54 AM, Rasmus Villemoes wrote: > > I see something similar, but at the 30->31 transition, and the > branch-misses remain at 1-3% for higher values, until 42 where it drops > back to 0%. Anyway, I highly doubt we do a lot of string copies of > strings longer then 32. So I really dislike that microbenchmark, because it just has the same length all the time. Which is very wrong, and makes the benchmark pointless. A big part of this all is branch mispredicts, you shouldn't just hand it the pattern on a plate. Anyway, the reason I really dislike the patch is not because I think strscpy() is all that important, but I *do* think that the word-at-a-time thing is conceptually something we do care about, and I hate removing it just because of KASAN not understanding it. So I'd *much* rather have some way to tell KASAN that word-at-a-time is going on. Because that approach definitely makes a difference in other places. Linus