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=-3.8 required=3.0 tests=BAYES_00,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 A1F02C433E3 for ; Sun, 16 Aug 2020 04:17:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 647A6206F4 for ; Sun, 16 Aug 2020 04:17:29 +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="nqQJCuM+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 647A6206F4 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 D3A6E6B0002; Sun, 16 Aug 2020 00:17:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEAE36B0003; Sun, 16 Aug 2020 00:17:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C01666B0005; Sun, 16 Aug 2020 00:17:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id A630C6B0002 for ; Sun, 16 Aug 2020 00:17:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5E2BD180AD81F for ; Sun, 16 Aug 2020 04:17:28 +0000 (UTC) X-FDA: 77155122576.24.hands21_0112e7d2700b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 2FB2C1A4A0 for ; Sun, 16 Aug 2020 04:17:28 +0000 (UTC) X-HE-Tag: hands21_0112e7d2700b X-Filterd-Recvd-Size: 2714 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Sun, 16 Aug 2020 04:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=E7QlbIVbd/kua+RC3z3/CIsH6rwOPqm/rCp6a5e3tB0=; b=nqQJCuM+Pp2/akFQ8SOxLAxR9h KQwQefXTFy+6Pqf8eqNwFFeHZbih5SK89H4QLXch0SddyZfioKGT7IIqQWTXig64Npscp9QwwDEKF E0AHFZTguAXzB7f2EufRNGEFhppaADrk0GW6jR+lGWTPD05isEhtDbK7wL8n0bUm75jGKdNBOOuio brxujJZldkr4OyIji5j4paeNkR9iV94l0yFyYhgBnqPl/d/aN4pkN8IX2CHYXIsd2pFFL9czNNlZH vxlrBVtF0uVJ/9O4oVqWK4L0sJtCxbz6fDsTbmdOgdgCwmznVH5AMxkbMnCVIDkP6J+5f3Z7BRcsP 1UyPP8lg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7A6i-0001Ww-BV; Sun, 16 Aug 2020 04:17:20 +0000 Date: Sun, 16 Aug 2020 05:17:20 +0100 From: Matthew Wilcox To: Alex Shi Cc: Andrew Morton , Hugh Dickins , Alexander Duyck , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm/pageblock: remove false sharing in pageblock_flags Message-ID: <20200816041720.GG17456@casper.infradead.org> References: <1597549677-7480-1-git-send-email-alex.shi@linux.alibaba.com> <1597549677-7480-2-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1597549677-7480-2-git-send-email-alex.shi@linux.alibaba.com> X-Rspamd-Queue-Id: 2FB2C1A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Sun, Aug 16, 2020 at 11:47:57AM +0800, Alex Shi wrote: > Current pageblock_flags is only 4 bits, so it has to share a char size > in cmpxchg when get set, the false sharing cause perf drop. > > If we incrase the bits up to 8, false sharing would gone in cmpxchg. and > the only cost is half char per pageblock, which is half char per 128MB > on x86, 4 chars in 1 GB. I don't believe this patch has that effect, mostly because it still does cmpxchg() on words instead of bytes. But which functions would benefit? It seems to me this cmpxchg() is only called from the set_pageblock_migratetype() morass of functions, none of which are called in hot paths as far as I can make out. So are you just reasoning by analogy with the previous patch where you have measured a performance improvement, or did you send the wrong patch, or did I overlook a hot path that calls one of the pageblock migration functions?