Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4033167ybl; Mon, 3 Feb 2020 11:13:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz8daZGa0vkggDW/I00Vuygwskh52s8qwuoWNGj1R86iRuyB41meyMBLtmWiMXVsTpDUlQq X-Received: by 2002:aca:ec46:: with SMTP id k67mr364910oih.43.1580757212603; Mon, 03 Feb 2020 11:13:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1580757212; cv=pass; d=google.com; s=arc-20160816; b=xvvb5hhEE5tCdCTmZCKDX9dDCTYz4FpCtnO6yLByaM/8Fhui6xgxpVAqLKDdnGb+0O VwuNokO/Vd1OiOjsy/sXuJKA5jTLCOv3wZDEmYppYu+gaeHI6UyA+hIfHqmf5ongzdd3 SZxjGKIFAH9ZYeLANKcvpq8vBRg7TjiSZ11njYZhZ9XXHqJBUx5xChOxkjv1cBK4c02c BMndOWxOiThiZLEpGB80BLkJ4l1ubq/Nr148WSH5QnL/Oe0AHakPCU3wzzOyGMiyRhB8 gNCwFI1swQ50F7w1iLfn1yWlamLJwG3hR+4ye/2dAqJwEOLendtoarfsj62WyDIpVjyy v+1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=v1O9rHUWRTEwWexnSFtMT1OGgy4tpGYXX9cr2609f7o=; b=wzXgbw3fEGWN8km0KsaZGzxsV7OEb6Fs+MLXS0HdIOkjG6+qyve9UwfkP9ayjX5CL+ QST883vIAaV74tkfcxFma9/1Tld++l876PvQEeqPvRIh3QsG50Ie97p75OR7HoyrZ0MY GK/aq+ABlpOIMGqYX4jLlT05dfb27p84rVKyUYopguig6gube6YxnZI7YSw0qkMV3z+q yS6RSy2nAqPmHa8ersobpiOg6al90rI2k29pt53F55s6ldhUa//RvKrXa1E9q57XFcgO mSQsLES5VcJIx0DhGGm37Jm1fLK+8Q1lZV6vwcQ8+mQmd+k+H2frYPKhM53uJd88hk7E h6TA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=VQIv9cYz; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=QPrlGk43; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si9180169oto.116.2020.02.03.11.13.20; Mon, 03 Feb 2020 11:13:32 -0800 (PST) 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=@fb.com header.s=facebook header.b=VQIv9cYz; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=QPrlGk43; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729073AbgBCSZ3 (ORCPT + 98 others); Mon, 3 Feb 2020 13:25:29 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:12928 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728435AbgBCSZ2 (ORCPT ); Mon, 3 Feb 2020 13:25:28 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.42/8.16.0.42) with SMTP id 013IN5fB007312; Mon, 3 Feb 2020 10:25:21 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=facebook; bh=v1O9rHUWRTEwWexnSFtMT1OGgy4tpGYXX9cr2609f7o=; b=VQIv9cYzberpHy3qaOXdByHdUnSR2oQi6xYqhlToofinH6w9A5hCXpbSIxH5Wn74OLhx BmGB3uZJ+6n3t5ZngTs8NEcaNDmyJEOUQyjSdFkPaBBS+xnR5QtK/kTbjdWJ4YcuNx+q NdCLY6pfwc65SL90RGqlEbyM8pYqHTHffbI= Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net with ESMTP id 2xx439mcnb-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 03 Feb 2020 10:25:20 -0800 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (100.104.31.183) by o365-in.thefacebook.com (100.104.36.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 3 Feb 2020 10:25:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aoHLWtaRlhGqUUN60PbBbJOb9ZXvbiZ5sm9ngJJqIY9PyaIS8a62ojWBvyM1FpMV4lcQBkHKtsLpdhYB6R0Xk5vCXgiZH+KyyfU/Y1vz8b/j+8TpBqykk/s4YY5978BFGImWhSHzuWofveLmfTWnZHoSFLVu9L/9rwQ3M3V1PNBdDc91zlytrnMkiQPbtXnQr6FRVbYI8tVBplmD4fwzSlBroxfwPhdijGkxmjWkQ8upPGcJptOGgE6C8aH1/Bpw1nOYYQxLkTvcC+vzOkVImiJCG32E7ebLRjsNyY4AnePEX0fJ2I3kZJVWe7neVx8zs7v05FQv/B+buPObrHxOXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v1O9rHUWRTEwWexnSFtMT1OGgy4tpGYXX9cr2609f7o=; b=DosfmzoGhA22XfgZgxXtgCCJhZkCMcHcNsCSCMkzV6uoGIfbdACXtGrBZOU/b+EWQP1ivKXoSXHv1CjK9HILQXyfhO4T10DV7bIARBjEtcBrus7LO9z0D1+McfEPUCULechjbjBDSfxhkJfKeUDFtoyD0jNuYa/KIPUKBufLum0HcRGuOY17SgB2JQL6rCH4Rbu2x9S/cSTdpfKVdI7Ij9vq2rfaV2ilvaFO+RYdxgjI5trcUg8btOOV4g11e5dUXkSUb70En3orJsRSLb0a8y8+WlJoFjqoXAkrE89oGR+4B7BvX4eIXkZssMJUhJyM9siO7pNIa05Auo+ZQfBizQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector2-fb-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v1O9rHUWRTEwWexnSFtMT1OGgy4tpGYXX9cr2609f7o=; b=QPrlGk43zOaw7Bi0l5eFzSrqdwtN/PJtiK6tSnzgDHhk49N3CPU1gjHTF5rjFwj4Y7D6mquD8+LV91SZYoXmxztRoVDXPLeH/RkEzaV5i1X9ICkAEZhzo+hVtFWV+1a77RXca8ATUj5HgwoqsknFBXmqhtYM5V67y7KRbxIQUZM= Received: from BYAPR15MB2631.namprd15.prod.outlook.com (20.179.155.147) by BYAPR15MB2424.namprd15.prod.outlook.com (52.135.194.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.29; Mon, 3 Feb 2020 18:25:13 +0000 Received: from BYAPR15MB2631.namprd15.prod.outlook.com ([fe80::ccb6:a331:77d8:d308]) by BYAPR15MB2631.namprd15.prod.outlook.com ([fe80::ccb6:a331:77d8:d308%7]) with mapi id 15.20.2686.031; Mon, 3 Feb 2020 18:25:13 +0000 Date: Mon, 3 Feb 2020 10:25:06 -0800 From: Roman Gushchin To: Johannes Weiner CC: , Andrew Morton , Michal Hocko , Shakeel Butt , Vladimir Davydov , , , Bharata B Rao , Yafang Shao Subject: Re: [PATCH v2 12/28] mm: vmstat: use s32 for vm_node_stat_diff in struct per_cpu_nodestat Message-ID: <20200203182506.GA3700@xps.dhcp.thefacebook.com> References: <20200127173453.2089565-1-guro@fb.com> <20200127173453.2089565-13-guro@fb.com> <20200203175818.GF1697@cmpxchg.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200203175818.GF1697@cmpxchg.org> X-ClientProxiedBy: MN2PR04CA0013.namprd04.prod.outlook.com (2603:10b6:208:d4::26) To BYAPR15MB2631.namprd15.prod.outlook.com (2603:10b6:a03:150::19) MIME-Version: 1.0 Received: from xps.dhcp.thefacebook.com (2620:10d:c091:480::8957) by MN2PR04CA0013.namprd04.prod.outlook.com (2603:10b6:208:d4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.32 via Frontend Transport; Mon, 3 Feb 2020 18:25:10 +0000 X-Originating-IP: [2620:10d:c091:480::8957] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58c28c4c-a4e9-4cd4-593d-08d7a8d668b7 X-MS-TrafficTypeDiagnostic: BYAPR15MB2424: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-FB-Source: Internal X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0302D4F392 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(376002)(366004)(39860400002)(346002)(396003)(136003)(189003)(199004)(6666004)(186003)(16526019)(66556008)(54906003)(6916009)(33656002)(6506007)(316002)(55016002)(4326008)(52116002)(5660300002)(7696005)(9686003)(478600001)(1076003)(66946007)(66476007)(8936002)(81166006)(8676002)(2906002)(81156014)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR15MB2424;H:BYAPR15MB2631.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OWZXTGiCQI+ik8nFclU7w5eOEr+oJo7E7T+pNgkVq4YzvCVROtf2VaZhIxPxUWN9RxMMndJvOTV0jK9AFb3j+6MIO6sjGBLAssZLqunKe+rMPttXKUBSlTifs3G3mECfzGySwQTLdvQj0nnVVqSODEcNn7LPEIIlBc5LNBfDn07nMqOUOrC5nm7kyEp0ZFLRuJ+W9rRIVK5/rtXP+mw7NcD4nfhNUrB5qchQ/Snh1jNLLJljPOXzQyycJgrUbF9NP+MOgeyytXlsZNlQVX+l0UHSqpcO6LgnBYRYWDdDHCrrlQWxBrd15TE8ByrD3H3Q1JN3SS3xVmCeNJe15FvnHZnDNG3IpCwiY9XX/J5ruT4i2jxz3h0wwoHvS/RVGV6ctpG6jOAmkHiTklLvWbDuuLByBS2QRvfwMcWSSGj+5bz2WoM6v5Lh7DES7Nle5SdP X-MS-Exchange-AntiSpam-MessageData: IB/jxATprqc8l5KvuLEWhHag5DV6DPqufW2T/Zs2W70L8xR0715CgtOonFaXoCo8bxeu/nJfODWbeMSukjIuJRSSZCn2SDNc8M1+hZb73pCjWSxKPLQr8RxAck/2uX+47QDrBovIYufLT0QTXJHZIec+Rj5fJRC570Q5yjGdTAk= X-MS-Exchange-CrossTenant-Network-Message-Id: 58c28c4c-a4e9-4cd4-593d-08d7a8d668b7 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2020 18:25:13.0867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oAxl0tzLaEZ8vkP6W6ctMKNrspvvLFbznsV6FGDqD/DZsp3lNa+y6zdnGDc4YgoB X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR15MB2424 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-03_06:2020-02-02,2020-02-03 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 clxscore=1015 priorityscore=1501 mlxscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 impostorscore=0 spamscore=0 suspectscore=5 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1911200001 definitions=main-2002030134 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 03, 2020 at 12:58:18PM -0500, Johannes Weiner wrote: > On Mon, Jan 27, 2020 at 09:34:37AM -0800, Roman Gushchin wrote: > > Currently s8 type is used for per-cpu caching of per-node statistics. > > It works fine because the overfill threshold can't exceed 125. > > > > But if some counters are in bytes (and the next commit in the series > > will convert slab counters to bytes), it's not gonna work: > > value in bytes can easily exceed s8 without exceeding the threshold > > converted to bytes. So to avoid overfilling per-cpu caches and breaking > > vmstats correctness, let's use s32 instead. > > > > This doesn't affect per-zone statistics. There are no plans to use > > zone-level byte-sized counters, so no reasons to change anything. > > Wait, is this still necessary? AFAIU, the node counters will account > full slab pages, including free space, and only the memcg counters > that track actual objects will be in bytes. > > Can you please elaborate? It's weird to have a counter with the same name (e.g. NR_SLAB_RECLAIMABLE_B) being in different units depending on the accounting scope. So I do convert all slab counters: global, per-lruvec, and per-memcg to bytes. Alternatively I can fork them, e.g. introduce per-memcg or per-lruvec NR_SLAB_RECLAIMABLE_OBJ NR_SLAB_UNRECLAIMABLE_OBJ and keep global counters untouched. If going this way, I'd prefer to make them per-memcg, because it will simplify things on charging paths: now we do get task->mem_cgroup->obj_cgroup in the pre_alloc_hook(), and then obj_cgroup->mem_cgroup in the post_alloc_hook() just to bump per-lruvec counters. Btw, I wonder if we really need per-lruvec counters at all (at least being enabled by default). For the significant amount of users who have a single-node machine it doesn't bring anything except performance overhead. For those who have multiple nodes (and most likely many many memory cgroups) it provides way too many data except for debugging some weird mm issues. I guess in the absolute majority of cases having global per-node + per-memcg counters will be enough. Thanks!