Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp383193pxb; Thu, 12 Nov 2020 06:19:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRt0771kMC83s/F9JDqA0qwc30GvB6yqRMoalbg3HvNV3VxYlTVPYKf3UxvgGFEmDFi58v X-Received: by 2002:a05:6402:3064:: with SMTP id bs4mr5585896edb.258.1605190780296; Thu, 12 Nov 2020 06:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605190780; cv=none; d=google.com; s=arc-20160816; b=vpIfMpRqf8RDsbgGSU+kpgkrNJICwmh2ExDKKNKU2bV9i1prKXjzQhEieEwA76IbUo K6GRaEQmS0NyPE9kSryhv2Z7VWuzKamRPEKkC8BxKcOlmqVbuHY09k+CDi8nmk+UwSHP yv+kfbwSkQaKZ6F+9zlqr6py0dc9rjGxGcE8jHc8iZJ+CnXUVXxBVl9S0jb2/DzyVklT 8DxzkIw4QQ5rLQDVWAyHktc47gyG/FOaAOI1Oh112Vv94mglNjNBbqbAO1AnWH+bJk0O hsYwKDyZzB+osX8CwbrHQOYEq/rISb2YVNqKVRwSFGUHYthzQ+IuZhO7Hoc0zHYIJNzW ZvuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LJVHqV6LpWMWjpPpVPlLXoFg+2DXw5+X4zlwjH+FBLM=; b=HYDgyosAJwtbzAVWc2IU2xVuE7rA56/VHzZPJj54EH/MMXfP7Ql4tf+eNNqSrbbcuy Y881jDqNo0Oh63GiGD2uDalxq34F9Jitiy3VOEYW/FlEWxRa4wn4mbmn22/UVkPIUX/L r/MTLn27QSOlCb2nAj05XoE5cpyrwHhnfQIefKd7azlsqA/ySD8zbxNAuKNS5CixaMng fiCGs5mvIyUuHKwlaT/qAm3F6iXPiPGlCAmidLsxB4y979IHPEHr3ljLNuNR/UeTHgyT mpO2szQk7uczIn2F5zforgNNhwPnMmyCaFsB/UaKMDNTygtTGdlekbC6hVEcgHpVS4r7 uycw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=U4sXm95N; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o62si4021303eda.318.2020.11.12.06.19.14; Thu, 12 Nov 2020 06:19:40 -0800 (PST) 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=pass header.i=@suse.com header.s=susede1 header.b=U4sXm95N; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728265AbgKLOQ7 (ORCPT + 99 others); Thu, 12 Nov 2020 09:16:59 -0500 Received: from mx2.suse.de ([195.135.220.15]:39540 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgKLOQ7 (ORCPT ); Thu, 12 Nov 2020 09:16:59 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1605190617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LJVHqV6LpWMWjpPpVPlLXoFg+2DXw5+X4zlwjH+FBLM=; b=U4sXm95NbyFSttsfUPs2xOdhTtY4E2oTcWrDTGvDHhem9gNboSkNck8fbFpVMvLxsDQohA mzmtaDZ084234AnF1FHveZwjcIO0OUFHhAMTnyn40qh0TUtIoRLlDLFcTlmJTZ96oDMfE3 PndsQYUgaTEjV+oXdnCXiJMsyxua2tM= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 39210ACC2; Thu, 12 Nov 2020 14:16:57 +0000 (UTC) Date: Thu, 12 Nov 2020 15:16:54 +0100 From: Michal Hocko To: Feng Tang Cc: Xing Zhengjun , Waiman Long , Linus Torvalds , Andrew Morton , Shakeel Butt , Chris Down , Johannes Weiner , Roman Gushchin , Tejun Heo , Vladimir Davydov , Yafang Shao , LKML , lkp@lists.01.org, lkp@intel.com, zhengjun.xing@intel.com, ying.huang@intel.com Subject: Re: [LKP] Re: [mm/memcg] bd0b230fe1: will-it-scale.per_process_ops -22.7% regression Message-ID: <20201112141654.GC12240@dhcp22.suse.cz> References: <20201102091543.GM31092@shao2-debian> <20201102092754.GD22613@dhcp22.suse.cz> <82d73ebb-a31e-4766-35b8-82afa85aa047@intel.com> <20201102100247.GF22613@dhcp22.suse.cz> <20201104081546.GB10052@dhcp22.suse.cz> <20201112122844.GA11000@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201112122844.GA11000@shbuild999.sh.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 12-11-20 20:28:44, Feng Tang wrote: > Hi Michal, > > On Wed, Nov 04, 2020 at 09:15:46AM +0100, Michal Hocko wrote: > > > > > Hi Michal, > > > > > > > > > > We used the default configure of cgroups, not sure what configuration you > > > > > want, > > > > > could you give me more details? and here is the cgroup info of will-it-scale > > > > > process: > > > > > > > > > > $ cat /proc/3042/cgroup > > > > > 12:hugetlb:/ > > > > > 11:memory:/system.slice/lkp-bootstrap.service > > > > > > > > OK, this means that memory controler is enabled and in use. Btw. do you > > > > get the original performance if you add one phony page_counter after the > > > > union? > > > > > > > I add one phony page_counter after the union and re-test, the regression > > > reduced to -1.2%. It looks like the regression caused by the data structure > > > layout change. > > > > Thanks for double checking. Could you try to cache align the > > page_counter struct? If that helps then we should figure which counters > > acks against each other by adding the alignement between the respective > > counters. > > We tried below patch to make the 'page_counter' aligned. > > diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h > index bab7e57..9efa6f7 100644 > --- a/include/linux/page_counter.h > +++ b/include/linux/page_counter.h > @@ -26,7 +26,7 @@ struct page_counter { > /* legacy */ > unsigned long watermark; > unsigned long failcnt; > -}; > +} ____cacheline_internodealigned_in_smp; > > and with it, the -22.7% peformance change turns to a small -1.7%, which > confirms the performance bump is caused by the change to data alignment. > > After the patch, size of 'page_counter' increases from 104 bytes to 128 > bytes, and the size of 'mem_cgroup' increases from 2880 bytes to 3008 > bytes(with our kernel config). Another major data structure which > contains 'page_counter' is 'hugetlb_cgroup', whose size will change > from 912B to 1024B. > > Should we make these page_counters aligned to reduce cacheline conflict? I would rather focus on a more effective mem_cgroup layout. It is very likely that we are just stumbling over two counters here. Could you try to add cache alignment of counters after memory and see which one makes the difference? I do not expect memsw to be the one because that one is used together with the main counter. But who knows maybe the way it crosses the cache line has the exact effect. Hard to tell without other numbers. Btw. it would be great to see what the effect is on cgroup v2 as well. Thanks for pursuing this! -- Michal Hocko SUSE Labs