Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2421677ybi; Thu, 18 Jul 2019 08:08:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhdVe/NZGkySRXaeDLSDafwNNW/FCnzRClvtpojpUE+kP2uVC3hj+JRclLUalsXrOoI372 X-Received: by 2002:a63:fb14:: with SMTP id o20mr36983395pgh.136.1563462539722; Thu, 18 Jul 2019 08:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563462539; cv=none; d=google.com; s=arc-20160816; b=cJomEdJFpdo2FF+hsHoKJHUyW0pMPKxtOh3IRK2rdvaw/d7QbkRFGGMraonhnQ4YCS C4RO6C8zsmxjN3M+Hs2OpSSuRMdtLR4Qxq7YFE65XXsN8nKlcLnObDW1y517JK/WwEIX WBemzpAJ3AXamhKq0dtcL37lK5ymigtvjXd7gwqMyilfHB8vf+7OlWzFkTh66KlBxr12 /w0VUH8t5N72YWtX1qTlMOLurxncFgzNJwoGeRj4Rqt+dwJAzpxo04mUOp3WT23RSgIT HSdmjcVI0vM5c0McMoJqkJ5dmysRfQEk+dMvfzOHisyH9iescq9ZV4m4Ft12va6LgSnX 8Kyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=r+b1A4l2F9g/q3ITgDkPw72qBmDym1kZ98ZmcHn0K5o=; b=BUtsgxl2do44YOwhyg9yowDq917YQl2lhsK8hR++nf0FLIYvrhA5ZWv3yDMiK4Grqw Ssbyj8uMpgrIs2v11x/UF0CEh+Iq+7N7AJAze7GIgooxhAQJLJj6gUDuPhnLcMiYYF2J DhDM+goTEwNvJQ/F27CegqeOH8JUuE/nrWBPC/U8QSLpw3m2RagsmggJouv5zqhd5ndN 7OND2uv0BF4XMxx8aLhya8SCY5zTkoENYTY5pnRH2VcwZ5HgtL/JP4R/Cgfw/gCq7uGY mS7rjrcb2D9aYwd1fliOEPzyBgPWcgTjj8qL3GslZm4oyHR1qCIxUQmLxfmrSolBxm1L ohtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=fONq6q23; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si3211096pfc.155.2019.07.18.08.08.42; Thu, 18 Jul 2019 08:08:59 -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=@yandex-team.ru header.s=default header.b=fONq6q23; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390241AbfGRPII (ORCPT + 99 others); Thu, 18 Jul 2019 11:08:08 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:44410 "EHLO forwardcorp1j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbfGRPII (ORCPT ); Thu, 18 Jul 2019 11:08:08 -0400 Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 4DA4B2E14E5; Thu, 18 Jul 2019 18:08:05 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id eXvUEDwHGP-84N4WWpg; Thu, 18 Jul 2019 18:08:05 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1563462485; bh=r+b1A4l2F9g/q3ITgDkPw72qBmDym1kZ98ZmcHn0K5o=; h=In-Reply-To:Message-ID:From:Date:References:To:Subject:Cc; b=fONq6q23F+TbpfJUloG+4AFtEiPFAzYalIZRoJbbZtzbwYfw3hOzrUGevBCgpBLt3 1xSMeWyElu/EiB0c1Y+1qjl6d0f01J5sGN8KzRd1VKZmnVt2ItWA0zRZR1M8fp7vAM uWPWO5qTXUNSaNYmvs/LfFEkPVA88TEFptog/Nzc= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:38d2:81d0:9f31:221f]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id QzWFJEUVAn-84ISGi64; Thu, 18 Jul 2019 18:08:04 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: Re: [PATCH 2/2] mm/memcontrol: split local and nested atomic vmstats/vmevents counters To: Johannes Weiner Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko References: <156336655741.2828.4721531901883313745.stgit@buzz> <156336655979.2828.15196553724473875230.stgit@buzz> <20190717175319.GB25882@cmpxchg.org> From: Konstantin Khlebnikov Message-ID: Date: Thu, 18 Jul 2019 18:08:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190717175319.GB25882@cmpxchg.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.07.2019 20:53, Johannes Weiner wrote: > On Wed, Jul 17, 2019 at 03:29:19PM +0300, Konstantin Khlebnikov wrote: >> This is alternative solution for problem addressed in commit 815744d75152 >> ("mm: memcontrol: don't batch updates of local VM stats and events"). >> >> Instead of adding second set of percpu counters which wastes memory and >> slows down showing statistics in cgroup-v1 this patch use two arrays of >> atomic counters: local and nested statistics. >> >> Then update has the same amount of atomic operations: local update and >> one nested for each parent cgroup. Readers of hierarchical statistics >> have to sum two atomics which isn't a big deal. >> >> All updates are still batched using one set of percpu counters. >> >> Signed-off-by: Konstantin Khlebnikov > > Yeah that looks better. Note that it was never about the atomics, > though, but rather the number of cachelines dirtied. Your patch should > solve this problem as well, but it might be a good idea to run > will-it-scale on it to make sure the struct layout is still fine. > Looks like this patch shows 2% regression for 24 core 2 numa node machine I have. Compete remove of these counters gives 2% boost. Also I cannot reproduce regression fixed by commit 815744d75152 - revert have no effect. So, feel free to ignore second patch. I'll play with this a little more. Maybe atomic per-numa counters could give nice balance between scalability add overhead. Ideally this memory could be mapped in per-cpu manner to give atomic access via fs/gs.