From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no 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 EDFDFC433E1 for ; Thu, 27 Aug 2020 17:52:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA6BE2087E for ; Thu, 27 Aug 2020 17:52:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="nYqz1M9i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA6BE2087E 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 4FE7A8E0007; Thu, 27 Aug 2020 13:52:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48DCF8E0003; Thu, 27 Aug 2020 13:52:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 377748E0007; Thu, 27 Aug 2020 13:52:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 1E9BF8E0003 for ; Thu, 27 Aug 2020 13:52:35 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CB75B1E01 for ; Thu, 27 Aug 2020 17:52:34 +0000 (UTC) X-FDA: 77197093428.20.oil89_4411fce2706f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id A959F180C07AF for ; Thu, 27 Aug 2020 17:52:34 +0000 (UTC) X-HE-Tag: oil89_4411fce2706f X-Filterd-Recvd-Size: 4519 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 17:52:34 +0000 (UTC) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07RHpF7T009589 for ; Thu, 27 Aug 2020 10:52:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=facebook; bh=3/tzIIGNMqjCFTV6v9V1vjpzFF8zvMk/JrTc+/xE3aE=; b=nYqz1M9iOQYO7XCbaLne6uvxy/9bVYX6Hjn128VPZGcIB4L1L+MVErcJShTSMggLt+4v O68DC5RY03HViyNfC2tf5lgs9p/phYzxl4BtVAfZqDnCqGAXZpKAUmG/LChTeCACvcX/ AuzemBmj4Mr3yhWBoY2jLvwBIKVfnusOhKM= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 335up66k23-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 27 Aug 2020 10:52:33 -0700 Received: from intmgw001.41.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 27 Aug 2020 10:52:19 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id 2ABFE3922481; Thu, 27 Aug 2020 10:52:16 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm1096.prn0.facebook.com To: CC: Andrew Morton , =Shakeel Butt , Johannes Weiner , Michal Hocko , , , Roman Gushchin Smtp-Origin-Cluster: prn0c01 Subject: [PATCH RFC 0/4] mm: kmem: kernel memory accounting in an interrupt context Date: Thu, 27 Aug 2020 10:52:11 -0700 Message-ID: <20200827175215.319780-1-guro@fb.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-27_10:2020-08-27,2020-08-27 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 adultscore=0 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 suspectscore=1 phishscore=0 mlxlogscore=539 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008270134 X-FB-Internal: deliver X-Rspamd-Queue-Id: A959F180C07AF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 implements memcg-based memory accounting of allocations made from an interrupt context. Historically, such allocations were passed unaccounted mostly because charging the memory cgroup of the current process wasn't an option. Also performance reasons were likely a reason too. The remote charging API allows to temporarily overwrite the currently active memory cgroup, so that all memory allocations are accounted towards some specified memory cgroup instead of the memory cgroup of the current process. This patchset extends the remote charging API so that it can be used from an interrupt context. Then it removes the fence that prevented the accounting of allocations made from an interrupt context. It also contains a couple of optimizations/code refactorings. This patchset doesn't directly enable accounting for any specific allocations, but prepares the code base for it. The bpf memory accounting will likely be the first user of it: a typical example is a bpf program parsing an incoming network packet, which allocates an entry in hashmap map to store some information. Roman Gushchin (4): mm: kmem: move memcg_kmem_bypass() calls to get_mem/obj_cgroup_from_current() mm: kmem: remove redundant checks from get_obj_cgroup_from_current() mm: kmem: prepare remote memcg charging infra for interrupt contexts mm: kmem: enable kernel memcg accounting from interrupt contexts include/linux/memcontrol.h | 12 ------- include/linux/sched/mm.h | 13 +++++-- mm/memcontrol.c | 69 ++++++++++++++++++++++++++++---------- mm/percpu.c | 3 +- mm/slab.h | 3 -- 5 files changed, 63 insertions(+), 37 deletions(-) --=20 2.26.2