Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1697343imu; Sun, 18 Nov 2018 07:05:22 -0800 (PST) X-Google-Smtp-Source: AJdET5e4E7kub0VOKZoqIVGGjjATFGejEdqIaHTtzJ2bx0LCXxjxN5XEAEUohQTq//KhlhbJRrpI X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr19070748plt.34.1542553522263; Sun, 18 Nov 2018 07:05:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542553522; cv=none; d=google.com; s=arc-20160816; b=eU4KNa6Gv07WZRKt7fiJ27A61Zl6WjLA6AGbz13FSrVM5JySUSlAVbkGcO8Hf1p/6X 2ZX0PuLDjfnBFRWwxJWLH/r35ufo18DlLhQzZ4ystQtzKeVXC6XAvkbHBHrjDqHYfHMR rzi83wox4MivFIiZbygdrjUDtJqhyK21W+O6zJP08Wz00c9DUjdeNcEFV0kLIQ3GNLil wr8HBARzlVMg18mcYNc309xGjGj+6U8VIOH8qara9tvX1bs/spqzL96K9yHscAZ5Ad0S aMqi33Ppz27NyiP1vRNf6qAXOcxpRwZVd0+ZRSoLbGHY5hEHX+1XfKQka/zcM9ONM+10 XRuw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=uXAPoxwEEap10gcpSJxdYyfAqqZm/P6DHqqPsQGvZU4=; b=wgLavbVPlPWrYlK7uD3CB0O0lOfG5RhKgkZvT5DFxhnsnur9ootOgMIaUpcH2D7FAN DMvisDpIdkkHMIG6K9KPu5EbiHNgcHTEXTmKVje5sxEqgqQSE06ztAGNMk/RZRj6Z4A2 8GgXXA7DnVnKbNd2VkxUxH8enPXg9sXAvwgL3Ub+uhsi8/KRnSoJKW38s5R4FdXYURbT Cr7U2HLtF6CACf8a3BGUrZUzx/XODvtxV77Llhl9qnJ8Gll37tKuNK9fb5GjreDWJIMK TxjOiCEY3DjPa1LK9aWbAbPgN59hRG0U/c8bSFkrq95dn1Jbu4FJnZwq/kopf7uvApxR fWZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pGyrziZB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si20050935pgj.415.2018.11.18.07.04.34; Sun, 18 Nov 2018 07:05:22 -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=pass header.i=@gmail.com header.s=20161025 header.b=pGyrziZB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727203AbeKSBX1 (ORCPT + 99 others); Sun, 18 Nov 2018 20:23:27 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:50535 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbeKSBX1 (ORCPT ); Sun, 18 Nov 2018 20:23:27 -0500 Received: by mail-it1-f195.google.com with SMTP id a185so3340402itc.0 for ; Sun, 18 Nov 2018 07:02:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uXAPoxwEEap10gcpSJxdYyfAqqZm/P6DHqqPsQGvZU4=; b=pGyrziZB/wLVfPyEOMraevd6a0sqhsq5Qal4zYmZN/cYA6lCpjHCu3uh1fBwOWfc72 HRlky4rZ14VBwLnBsycadY3z1juWITI9t6Iuw2wuYS/v/6/cPDFMzx2tosvLdM0pJukK uiTYsmhMgaFqYhmLb0+UwhA20pp7SUjvne8aHXjnwX8Dzi54DwfMXLwbTEXprMWZ6yQN HmxTAWxYlm8xMdXWxSX2IRWm8/DFQ7/PYxNOV9pYFBAVCjqOb7uEEOUacUWGG8pG6+29 QV5S0Ag79EMeup60FEJ+KM0qllSyniBSuTOfVWsKgjV7PopI9IARVTDycxrhHDfWUtrD uN3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uXAPoxwEEap10gcpSJxdYyfAqqZm/P6DHqqPsQGvZU4=; b=haSmRPnFR0aLpWUgj3nFFPH93NbPI1SlKaVuQ98Hn6Fx6GTCuMyv8kvEKD6RNuAXQC 0vmpN8mnSexzV5UszWzPzajdcC37IW8ro/+22y+cTxEewWuHBzP1NVg9BONto/bDah/b wzHGL4MEiG1/dN0abxBAWMhRqJoCsBiv3oqGYj5w30lyFqojuhPN2jHRFBtpicwNRNLZ zyib97ZlZLZIs+hPUhG1UzpszPpJczZK2ozUVbBHVHzXsIeojDMhCwyMCPeveXUJEG2j tQFioaKiUY19b1wrOeAEZbywT1+99rJ6gzUfDejEplIUNER7ctNGir/HTrsitv7aIQrt ffqw== X-Gm-Message-State: AA+aEWad3iQKDbQGYuMKy6u3ZvqcyUYvEF0tmVvM2rTtsF38pZpjaDH0 ecnciri+FQQ9f0iOgGdnkWCoKAU82hqtk8Ced1s= X-Received: by 2002:a24:f982:: with SMTP id l124mr5166077ith.59.1542553375686; Sun, 18 Nov 2018 07:02:55 -0800 (PST) MIME-Version: 1.0 References: <1542542538-11938-1-git-send-email-laoar.shao@gmail.com> <20181118121318.GC7861@bombadil.infradead.org> In-Reply-To: <20181118121318.GC7861@bombadil.infradead.org> From: Yafang Shao Date: Sun, 18 Nov 2018 23:02:19 +0800 Message-ID: Subject: Re: [PATCH] mm/filemap.c: minor optimization in write_iter file operation To: willy@infradead.org Cc: Andrew Morton , darrick.wong@oracle.com, Linux MM , LKML 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 Sun, Nov 18, 2018 at 8:13 PM Matthew Wilcox wrote: > > On Sun, Nov 18, 2018 at 08:02:18PM +0800, Yafang Shao wrote: > > This little adjustment on bitwise operation could make the code a little > > faster. > > As write_iter is used in lots of critical path, so this code change is > > useful for performance. > > Did you check the before/after code generation with this patch applied? > Yes, I did. My oompiler is gcc-4.8.5, a litte old, and with CONFIG_CC_OPTIMIZE_FOR_SIZE on. The output file is differrent. > $ diff -u before.S after.S > --- before.S 2018-11-18 07:11:48.031096768 -0500 > +++ after.S 2018-11-18 07:11:36.883069103 -0500 > @@ -1,5 +1,5 @@ > > -before.o: file format elf32-i386 > +after.o: file format elf32-i386 > > > Disassembly of section .text: > > with gcc 8.2.0, I see no difference, indicating that the compiler already > makes this optimisation. Could pls. try set CONFIG_CC_OPTIMIZE_FOR_SIZE on and then compare them again ? Thanks Yafang