Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1453895ybh; Sun, 8 Mar 2020 04:51:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvhaLrQhI1X5swebiTLtrVBW5Wrz10z03m6OILONMWTrUZm2VT+TQY59kBUGO89MhMlTFfj X-Received: by 2002:a9d:6a0b:: with SMTP id g11mr5599374otn.31.1583668290907; Sun, 08 Mar 2020 04:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583668290; cv=none; d=google.com; s=arc-20160816; b=AWbVZfolaxu/uyJMJJWDQO5pBJZJPWDezs6mPlFppqVHH1l/7RxstxnnKMrAGPHluF hDvPkcUUq4I5nfNlZhUxIrP8O4K06AWnsY8s7/OFc2OjsW14Vwnvyc/Byd/6eLREitBm d5ZbY9rvPu6TruAAQ9C/B7pLsTqt3IxjMPySJIbQJTHk+70RiL5Q56ZEw6b7GlUCwAx7 iAW8jNP47Plk/vihdc5ppF3t2bkQ5IDuck4k7BpfOMVsDCSIWnTox14+exhRO+7syEr3 yS+MyWL2UKCl+KXSDGTOrqfLIX9zBJBYIx0U5acG14H2JPJWWPE9gwPkP5D4bkh0Idcw Ppcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=roRbR4edE009phJ4jS/XgUrQgBpty89xGIVuf7gn68s=; b=K2tmw/C8w6uMYUtoKGH6AhmqTM/BnPp6eEZz0KVaqKxt2OSAxYh6g3tJ9ZSoSQv18Y ySo/Rm8qYiOwMfPcvwvbd6JGX1wsziOhulrefRAI/+eD6UYZFO4gOH6VYWP4BNwXyy9u GWmghTgAldivKdbarIJDh8kgF8XG++jwFRIZKrzdewjaBRcDDPFexJno39YutWCX22I3 HZnSg3Tv82cV+FVkVDC+k9DNcSeWV0/O6W/YIucOejGaU7dsN9cxjM27qIrFihA88Q1X TJbH9Lbt2Umg4TS5oAALSe220PPhVtGXZqMRoO+YKjqkKv8d+Gb3GgB6zEAoeYGD9UKT dQbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IV7IX21v; 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 y24si2888914oih.7.2020.03.08.04.51.19; Sun, 08 Mar 2020 04:51:30 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IV7IX21v; 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 S1726333AbgCHLuJ (ORCPT + 99 others); Sun, 8 Mar 2020 07:50:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41580 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbgCHLuJ (ORCPT ); Sun, 8 Mar 2020 07:50:09 -0400 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)