From patchwork Thu Jun 3 01:09:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12295955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E03FAC47093 for ; Thu, 3 Jun 2021 01:09:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 93B76613F0 for ; Thu, 3 Jun 2021 01:09:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93B76613F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=fb.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6886B6B006C; Wed, 2 Jun 2021 21:09:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6120B6B0072; Wed, 2 Jun 2021 21:09:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3525D6B0070; Wed, 2 Jun 2021 21:09:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id F2B266B006C for ; Wed, 2 Jun 2021 21:09:40 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 984A4180AD806 for ; Thu, 3 Jun 2021 01:09:40 +0000 (UTC) X-FDA: 78210630120.06.0FD0932 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf16.hostedemail.com (Postfix) with ESMTP id 0FAF280192FE for ; Thu, 3 Jun 2021 01:09:26 +0000 (UTC) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.43/8.16.0.43) with SMTP id 15316l7r032654 for ; Wed, 2 Jun 2021 18:09:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=facebook; bh=KO8JkSHCwG7e23QxvM9nsBY5zrZc1fBJQC4hthtjNKw=; b=SKkbCx1cf6nS3LtRHiK3SBdlJJmlNS2/HeIRjHwdrw/bz3GeBdUtxOl6F4qe4vdMZ9jW 5iLDD7KFg+2mTJfws2cc/gMy4G5W8M/vbPP9AankLAaDBMFMzKlCcZPKvDYNZGOrJ61i 6r8XeOUsbJHSfsx0xpleQTTdDz/x4BfxOd8= Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net with ESMTP id 38xby4bnvt-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 02 Jun 2021 18:09:39 -0700 Received: from intmgw002.46.prn1.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c085:11d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 18:09:37 -0700 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id C6D1A7F1B33E; Wed, 2 Jun 2021 18:09:32 -0700 (PDT) From: Roman Gushchin To: Dennis Zhou CC: Tejun Heo , Christoph Lameter , Andrew Morton , Vlastimil Babka , , , Roman Gushchin Subject: [PATCH v2 0/3] percpu: memcg memory accounting rework Date: Wed, 2 Jun 2021 18:09:28 -0700 Message-ID: <20210603010931.1472512-1-guro@fb.com> X-Mailer: git-send-email 2.30.2 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: zyV86_f9DaOXcfxMRRwPjhvVV9HcnjKK X-Proofpoint-GUID: zyV86_f9DaOXcfxMRRwPjhvVV9HcnjKK X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-02_11:2021-06-02,2021-06-02 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 phishscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 clxscore=1015 bulkscore=0 mlxlogscore=471 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030006 X-FB-Internal: deliver Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=SKkbCx1c; dmarc=pass (policy=reject) header.from=fb.com; spf=pass (imf16.hostedemail.com: domain of "prvs=578884e26b=guro@fb.com" designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=578884e26b=guro@fb.com" X-Stat-Signature: iyycojxu9oyy5t8r7bfj1ojxo44d38bd X-Rspamd-Queue-Id: 0FAF280192FE X-Rspamd-Server: rspam02 X-HE-Tag: 1622682566-421666 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patchset reworks memcg-based accounting of the percpu memory: instead of using two types of chunks (memcg-aware and non-memcg-aware) it treats all chunks as memcg-aware. An extra memory used for objcg arrays will is compensated by a better chunks utilization, so the total memory footprint should be the same or smaller. First two patches are preparational changes and cleanups on the memcg side. The third one is percpu accounting rework. v2: - make all chunks memcg-aware instead of on-demand objcg allocation, by Dennis v1: https://lkml.org/lkml/2021/5/11/1343 Roman Gushchin (3): mm, memcg: mark cgroup_memory_nosocket, nokmem and noswap as __ro_after_init mm, memcg: introduce mem_cgroup_kmem_disabled() percpu: rework memcg accounting include/linux/memcontrol.h | 5 ++ mm/memcontrol.c | 11 ++- mm/percpu-internal.h | 52 +-------------- mm/percpu-km.c | 5 +- mm/percpu-stats.c | 46 +++++-------- mm/percpu-vm.c | 11 ++- mm/percpu.c | 133 +++++++++++++++---------------------- 7 files changed, 88 insertions(+), 175 deletions(-)