From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D5FC10F28 for ; Sun, 8 Mar 2020 11:50:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E0C2420663 for ; Sun, 8 Mar 2020 11:50:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IV7IX21v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0C2420663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4BD566B0005; Sun, 8 Mar 2020 07:50:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46D266B0006; Sun, 8 Mar 2020 07:50:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35BDF6B0007; Sun, 8 Mar 2020 07:50:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 1BB956B0005 for ; Sun, 8 Mar 2020 07:50:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D5D6852B0 for ; Sun, 8 Mar 2020 11:50:11 +0000 (UTC) X-FDA: 76572026622.04.swing79_1e93e9be01f27 X-HE-Tag: swing79_1e93e9be01f27 X-Filterd-Recvd-Size: 2500 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sun, 8 Mar 2020 11:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=roRbR4edE009phJ4jS/XgUrQgBpty89xGIVuf7gn68s=; b=IV7IX21v8OQ5tnEIrI+9Wq+7zw 9OmRRy48F26TL3jNeUW9unwClxThGUe5HGXFC9RJATvoayH/ntdxyS8nIx7upou9Pg3hzq9z/8uJu 7GPuaJM6X47BLPm5YuB1iLKuRBBwsyrQiG/bAz+vfBr8VbhSFTyIBjXEfJem+kGhgKtISl4uxECJ4 PuUah+Axg0Y9M88bHERXWnE9P2AXUOmjdATCqEP9c5O7NaWescNdsWUdmFD6wEI6kZAVoBQywqZDe b6KIozUBuIqn1z7LgjPVscjmrt186A0YNjFnVGPxrJGphSzGXJkx9h1l0xga/gR6RcSxkIVDRtAVs myvd2zQw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAuRb-0004TL-Be; Sun, 08 Mar 2020 11:50:07 +0000 Date: Sun, 8 Mar 2020 04:50:07 -0700 From: Matthew Wilcox To: Andrew Morton Cc: mateusznosek0@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mm/page_alloc.c: Micro-optimisation Remove unnecessary branch Message-ID: <20200308115007.GE31215@bombadil.infradead.org> References: <20200307225335.31300-1-mateusznosek0@gmail.com> <20200307151542.b14131037dc44a8edcb22cad@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200307151542.b14131037dc44a8edcb22cad@linux-foundation.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Mar 07, 2020 at 03:15:42PM -0800, Andrew Morton wrote: > On Sat, 7 Mar 2020 23:53:35 +0100 mateusznosek0@gmail.com wrote: > > - if (unlikely(ac.nodemask != nodemask)) > > - ac.nodemask = nodemask; > > + ac.nodemask = nodemask; > > This will now unconditionally dirty the ac.nodemask cacheline, which > means that cacheline will need to be written back. If it is truly > unlikely that the write was needed then the thinking goes that the > test-and-branch is worthwhile, by saving on memory traffic. > > At least, I assume that's why the code is the way it is. The line immediately before this hunk is: ac.spread_dirty_pages = false; ac is on-stack and is only 32 bytes. I don't see a reason not to do this. Reviewed-by: Matthew Wilcox (Oracle)