Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2456845pxb; Fri, 5 Feb 2021 19:58:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVPPsIqpJeYrYz6GlvmWqmDDhjlzkndkVE8wg213pUysPYhnZ3Iw3qCQaKPpGf9D1Jw7ei X-Received: by 2002:a17:906:2495:: with SMTP id e21mr7119004ejb.280.1612583888748; Fri, 05 Feb 2021 19:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612583888; cv=none; d=google.com; s=arc-20160816; b=P4r6YtoI9X+hvrI+lSoTSc9TJu4NwCJcw2ZBLi7R43i/VLYIY7LfVfLaeGnqgTb8eQ GLi8NP7qE9fgRRaahs+Lp7hQlpj241J6HpPpXAtbdQA3lFehWIUankEZFkx/IfSTHUEN fxKJPx1Rc7ktrIxMXFzxExqTg4BaU1fxUia5E9u/NEt9z72b0MP1YZNtlQDRVQ9N7aWY 7srb+1Fz8VaZk3juYVyKDrQbv+WpQhqfjbMg9hvBsv+rhzY/HLZZZ85+tehsOw66FxWl hG4uBdbriLzReEHdwiRukAiaaC110iBgUItRYLS0kRBlYJdrHQhWM+F/L6pzbpd2DQYP xZ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=BvEH6gK5vy6U6r9sdT/DjPKO8VPOQaXUnS3mHbODZvs=; b=DlErL06Ew1YEuxz9vR15gIDe+bgatcZcoPYqlxhhebIyqflEbP9BIAihslQUoWzob0 xOQWApcUovUTW+yunWXb/qlXFBND5y5pN5Ch7IGizJ4/X68ffQYoBf5EiXujht21Syac yOvS86l/XZ4+twtpd9GW2qFbNX0G4iq6Ti8QJIWgq29fQ2SRgiJoNQxKaMycNuX1f8rl 1DTVjk912378kBUrcf18rusguT6am6UzPj7umJKw38KziNuX3gYu0OzXLW6pByidZn7H mzXNCtOqkT6JLQf0oXTtxGHfZDLg7W6DMVA0jl7+Tb2uojTY2Oe+baciEd+sFwyX6KQD vI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="R5/w6LL/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si6114042ejx.701.2021.02.05.19.57.45; Fri, 05 Feb 2021 19:58:08 -0800 (PST) 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=@linux-foundation.org header.s=korg header.b="R5/w6LL/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230438AbhBFDyj (ORCPT + 99 others); Fri, 5 Feb 2021 22:54:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:39750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbhBFCvz (ORCPT ); Fri, 5 Feb 2021 21:51:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0C2364FFE; Fri, 5 Feb 2021 23:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1612568749; bh=Pr7WM4tsg/J35Ck/YdPrRlNAqyJGCBTFnW6SViKvg+4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=R5/w6LL/l/5MQ3s4um0Uu/BR3/k3Ti0xT2rRqXouM/uVIohxIu+FMZgSbunGSBs68 mWrlLvl/kON51NM67TTxRuI35eQgjUnkfyrsmS93513iIJHdHMt3JVQ+vVdlQlY4xV uOlDmG1tkEIhblCx1yr3hfHl6QHpWHevhsC68JIk= Date: Fri, 5 Feb 2021 15:45:48 -0800 From: Andrew Morton To: Shaokun Zhang Cc: , , Yang Guo , Alexander Viro , Nick Piggin Subject: Re: [PATCH] fs/buffer.c: Add checking buffer head stat before clear Message-Id: <20210205154548.49dd62b161b794b9f29026f1@linux-foundation.org> In-Reply-To: <1612332890-57918-1-git-send-email-zhangshaokun@hisilicon.com> References: <1612332890-57918-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 3 Feb 2021 14:14:50 +0800 Shaokun Zhang wrote: > From: Yang Guo > > clear_buffer_new() is used to clear buffer new stat. When PAGE_SIZE > is 64K, most buffer heads in the list are not needed to clear. > clear_buffer_new() has an enpensive atomic modification operation, > Let's add checking buffer head before clear it as __block_write_begin_int > does which is good for performance. Did this produce any measurable improvement? Perhaps we should give clear_buffer_x() the same optimization as set_buffer_x()? static __always_inline void set_buffer_##name(struct buffer_head *bh) \ { \ if (!test_bit(BH_##bit, &(bh)->b_state)) \ set_bit(BH_##bit, &(bh)->b_state); \ } \ static __always_inline void clear_buffer_##name(struct buffer_head *bh) \ { \ clear_bit(BH_##bit, &(bh)->b_state); \ } \