Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5395628ybi; Tue, 28 May 2019 12:17:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQzGStKyAAlWJyNnvgh3l11BicDKOazD94MGx7ObMr7tfIH4o4KrdP+7yxACvZsAquW9Yu X-Received: by 2002:a63:9a52:: with SMTP id e18mr32259737pgo.335.1559071044358; Tue, 28 May 2019 12:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559071044; cv=none; d=google.com; s=arc-20160816; b=J0eYEDtH7Z5QfOkdBws6buDSbansrC0IUMkj5a64UFkTi2hNnPazd9SZscV6pnJtgn naIzyMHqDWrD/JRg69PRbv2/faDq7JYgPb/+xADMTwM2uqjxhPRUEw+hlmlmia4mT7YI KAfhaQpOmjtE3ha3ndoqq3mDmMfFtldMJv8YHlcn9kwuO9vcTlyfieQs/ZixBQ9RaTmC Uo8zrIS0UZH5nSj5yhvheJmwG67Wq09UWfMARJekD3O2vopzaKfQhFvZf/FQFavfPMHU Pa3o1/9en1gXj5CSZPYVFvryT6FAdz3ABZWYLDOxX4ic3dBnWfNhdJYzSBgh2r/Vdxvg i2Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=F2jMeMvfMZ6+f8aMiqek9ZN+qjHWyjCaTe5iI/rDq+E=; b=idu7NuKDDKmUPvdHhW4qXxJ+Wm9Vc8SthXQJpHvkA56ZnyQeBnriB0zQ+MHHnL/kvr /r34VTcwnovwK34ioPCrsWH9K6ikFaCwKtJf9P6BSWq+mOcteBu9wdRuII8hPmaYl9bp bjE9FNhM+FWUp14eHJIP7qyo+LCEmA9sq97QZ9ss2phrXNqG2WW+ZBkNjTTfDqD+T/I9 n6+Entq/paRxfWf/FucbLAGat1RHmWA9qcoooyQdUi0gPPi3h/x5+i8Svkx1XQRSXSp9 1aXnZMTsofaU4KVSLrN2PZu7QWjoVYTS23znU2m9qCwS0XNXC7uK2s1GNmxHvhnJukL+ 1Otg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=F1ETGdXe; 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 f17si23159327pgv.338.2019.05.28.12.16.02; Tue, 28 May 2019 12:17:24 -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=pass header.i=@linux-foundation.org header.s=google header.b=F1ETGdXe; 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 S1727033AbfE1Rhg (ORCPT + 99 others); Tue, 28 May 2019 13:37:36 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42739 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbfE1Rhf (ORCPT ); Tue, 28 May 2019 13:37:35 -0400 Received: by mail-lj1-f194.google.com with SMTP id 188so18507539ljf.9 for ; Tue, 28 May 2019 10:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F2jMeMvfMZ6+f8aMiqek9ZN+qjHWyjCaTe5iI/rDq+E=; b=F1ETGdXeFfCBHmdWbLBHd8vZ7taVOvI6ORkmxBqkgmnSIzcWwbuL7Fhv0S2FLp97AT XCPInppgu1tkfwt4dcLiPmzEju6ML58hvTfKMWoxMW2Wuusd11zPUwBSNYNdyPwqwnst 6LPs3DuCLXNIyE4Zp2se+L+KeAMs1gw7ROLd4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F2jMeMvfMZ6+f8aMiqek9ZN+qjHWyjCaTe5iI/rDq+E=; b=W4AObqTIiFN6Utsw5GAULitQz9FlEzzDHrLkTlGewtHsRhfKXxYHDmjEjKSsCa3q7Y umhUc/qBlCJavTcbpuIepP7VoztLPd3NvljdWfeCA2FUDn3RY99aH7nW1k+e2eJNs7Zo +fyIEAZv2sLfPF4iV+vA+zoQSnwB9qh2GYwh4FlEwgumfwMTtEu15Zc0MKDDQjLtDKOM dVthiafSaGrPJ2z5axBReDsvJqrYNN9pvxfWK/W6cfDmYMdXmpdUUk6msXbyRdrDk6xl 1fLdWGWYOZpxZ/xUwpABtj5dMCKMGAGh0Yp/SY4ldniM4Pvo8+XtJL2y8ZuC+amsXvGL TafQ== X-Gm-Message-State: APjAAAVKiyieIX6xDbZ95O0H/ug6RLhFjQ0f/wnRlrhGUt9AbqhTv8XA GNtNke6B4BdvHcCnCTjEYfaEUTj80go= X-Received: by 2002:a05:651c:150:: with SMTP id c16mr65590233ljd.65.1559065052784; Tue, 28 May 2019 10:37:32 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id v16sm3063623lji.88.2019.05.28.10.37.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 10:37:31 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id a10so7754697ljf.6 for ; Tue, 28 May 2019 10:37:31 -0700 (PDT) X-Received: by 2002:a2e:85d1:: with SMTP id h17mr49489655ljj.1.1559065051361; Tue, 28 May 2019 10:37:31 -0700 (PDT) MIME-Version: 1.0 References: <20190520063534.GB19312@shao2-debian> <20190520215328.GA1186@cmpxchg.org> <20190521134646.GE19312@shao2-debian> <20190521151647.GB2870@cmpxchg.org> In-Reply-To: From: Linus Torvalds Date: Tue, 28 May 2019 10:37:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: memcontrol: don't batch updates of local VM stats and events To: Shakeel Butt Cc: Johannes Weiner , Andrew Morton , kernel test robot , LKP , LKML , Michal Hocko , Roman Gushchin , Linux MM , Cgroups Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 28, 2019 at 9:00 AM Shakeel Butt wrote: > > I was suspecting the following for-loop+atomic-add for the regression. If I read the kernel test robot reports correctly, Johannes' fix patch does fix the regression (well - mostly. The original reported regression was 26%, and with Johannes' fix patch it was 3% - so still a slight performance regression, but not nearly as bad). > Why the above atomic-add is the culprit? I think the problem with that one is that it's cross-cpu statistics, so you end up with lots of cacheline bounces on the local counts when you have lots of load. But yes, the recursive updates still do show a small regression, probably because there's still some overhead from the looping up in the hierarchy. You still get *those* cacheline bounces, but now they are limited to the upper hierarchies that only get updated at batch time. Johannes? Am I reading this right? Linus