Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1540804pxa; Sun, 16 Aug 2020 02:13:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOoUZcRN5gUk55OY9xs0SUphUnSYW3H+wwbIE7x8edtgiBC9x1DsC1OV+EbutXa0UH+zLL X-Received: by 2002:a17:906:70c:: with SMTP id y12mr9471873ejb.231.1597569225296; Sun, 16 Aug 2020 02:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597569225; cv=none; d=google.com; s=arc-20160816; b=cmMB4+tvV1kHai9U/DoUjIJE3hnzn5OWOS1BS/eAhBuoPu2VSqbi7IYdCdtewAFwsy lX0FujpfgOd/Vw8mDsNfc87+wKY12qDa8XVnO0PpwZKyBvA0QetfupsR5qlPEv2PitXu yg3sP9qMlqhsK6ik9yjoxxWZ3TiYxjEn8qs0/FZht1inBJmZ8TEfDjxbBnRht+bOEg8V vs5V9Qna3TUMapr6vhIK1Wfc/LHMscdfTPyG8fAWj/ptWNHJyZSsR4EoYa4Pdg2rNze3 2KO+0gRDBiXvfR/02QsAdB11m/luj98sSpLsVjxnT2rrnkuOnpY37KTVhZdrwW1HAyiG PmWA== 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=E7QlbIVbd/kua+RC3z3/CIsH6rwOPqm/rCp6a5e3tB0=; b=HjcWj/UnBg8qTbLLBkMZKFve3ofkuEk0tQa7u7sTQUIYSY+Q6bOlW4Ov81QNOIOFWM WJyJSLXQOA1mnoOwHKGogv+JzOYkdWK93ZMbG2dY/tdpW6pGq6yT6Pnu9jNNaIcAyZQ3 sdED1yIfXMZr3F0fgQDSu2BsUkUgrwOAwxNdk49v+tHIyNmd8F8gMgxTUPjOW9DbSlQ1 7JzPgU8fYhtAtyNXuuSc0v4AFQFJc3sYCPxvzwntM4RQRGJCKmP5H8BBCSx2WTVVky18 CcN6azLwC328IM+WKcbMgfItiY0+oxOjNKNxY+yt0mwje82Kr1D5aJiDX/6iJ038pjHA i52Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=nqQJCuM+; 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 s3si8974785edy.554.2020.08.16.02.13.23; Sun, 16 Aug 2020 02:13:45 -0700 (PDT) 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=fail header.i=@infradead.org header.s=casper.20170209 header.b=nqQJCuM+; 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 S1729757AbgHPER0 (ORCPT + 99 others); Sun, 16 Aug 2020 00:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbgHPER0 (ORCPT ); Sun, 16 Aug 2020 00:17:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B751C061786 for ; Sat, 15 Aug 2020 21:17:25 -0700 (PDT) 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?