Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4152276imm; Sat, 21 Jul 2018 11:22:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3qKPlxIvVGEWT29nXod09jOgu2ZCfiZSQSu69BGfYz/XAhTpD05UySVv75BnuMFYrBZ/3 X-Received: by 2002:a63:5b0d:: with SMTP id p13-v6mr6511976pgb.202.1532197369625; Sat, 21 Jul 2018 11:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532197369; cv=none; d=google.com; s=arc-20160816; b=0+6LCbzt+aO01urHkCmHYOdE2soR0RLkk3eUBYoq8+aa6iizU73CCdMayoQHMGEnhj Mc4aBT9Qq8TObgz4ZyB5tzr5BNRGgWkdAo3myLtMVlCHhLrkaoab86BnkdS0jw558JHa g5cxxl5bKYIvmWLDDP7DkNHUtmO5NYb1IIU0djxXOGDQuljf6mHuobeLBUnnP5EORdUV 44fvyq4de5OETMADsfsVPS46snMzqo48vBnZsj8FeRwh5KqkoEPgAuc/qOY4j+UR7siV h17qv6EFF1ch+flPX+nbcuFoYG9Y2w4k6rnfVm7jaBO9AaxKGVx+cI3GvOPEOWWQbOdf YWeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=0WZ3gPCfcZo8HoBVCZkaOsex7I6cSUBK9CIndVmCXus=; b=YkQvC6KJmIuzrfDy21X2EY37pOLRwRsUfV8pTtDOmCKqf3tA0vlVg2QRUnK5UPMYYW FMX5JF5TjnV+0BLt0tLGEIGDmFAeccWPdQfvvXpXtuy8SEPxKarEfKEDzAS8WAmrRHa5 wryIt9jIZdVveCpAReJmY3K3/a78y/dd6pE09pmQcsIPyc3I0DdXffuM95w1a1QMZCIa YJiA/pb3PPvaIJjIewOJVDWKXp3oCiLB4SDw4JkNVHHOtlO6Yi7cd9m4LGlBGoSBhylN lM7BJhtMiXVY5x7er2UgFwbGACJ1gUQw/E9IiXrAGCZDL+RE/+wPIws6zrpgDVfzwkqk 9OOA== ARC-Authentication-Results: i=1; mx.google.com; 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 h18-v6si4502297pgd.238.2018.07.21.11.22.33; Sat, 21 Jul 2018 11:22:49 -0700 (PDT) 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; 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 S1728541AbeGUTOz (ORCPT + 99 others); Sat, 21 Jul 2018 15:14:55 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:35056 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728418AbeGUTOz (ORCPT ); Sat, 21 Jul 2018 15:14:55 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fgwVJ-0000p0-0j; Sat, 21 Jul 2018 18:21:17 +0000 Date: Sat, 21 Jul 2018 19:21:16 +0100 From: Al Viro To: Sean Fu Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs/buffer.c: Optimize grow_buffer function. Message-ID: <20180721182116.GC30522@ZenIV.linux.org.uk> References: <1532194217-19002-1-git-send-email-fxinrong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1532194217-19002-1-git-send-email-fxinrong@gmail.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 22, 2018 at 01:30:17AM +0800, Sean Fu wrote: > Use PAGE_SHIFT and i_blkbits of bd_inode directly to avoid ugly sizebits > calculation. > Remove ugly sizebits calculation. > Remove unnecessary sizebits parameter of grow_dev_page. > > Reduces code size: > > Before: > > sean@linux-zmni:~/sda5/source/linus_repo/linux> size fs/buffer.o > text data bss dec hex filename > 34037 1510 16 35563 8aeb fs/buffer.o > > After: > > sean@linux-zmni:~/sda5/source/linus_repo/linux> size fs/buffer.o > text data bss dec hex filename > 34021 1510 16 35547 8adb fs/buffer.o First of all, 16 bytes is pretty much noise. What's more, the "remove ugly sizebits calculation" part really needs an explanation of the reasons why it's safe. You assume that size == 1<bd_inode->i_blkbits; where's the proof that it always holds?