From patchwork Tue Mar 9 08:04:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12124319 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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 E2D16C433E0 for ; Tue, 9 Mar 2021 08:04:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57A4C652A4 for ; Tue, 9 Mar 2021 08:04:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57A4C652A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D5DD98D00C2; Tue, 9 Mar 2021 03:04:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D34F78D007F; Tue, 9 Mar 2021 03:04:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAEA88D00C2; Tue, 9 Mar 2021 03:04:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id A013E8D007F for ; Tue, 9 Mar 2021 03:04:43 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6DD7D1730875 for ; Tue, 9 Mar 2021 08:04:43 +0000 (UTC) X-FDA: 77899599246.17.847998B Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10128.outbound.protection.outlook.com [40.107.1.128]) by imf27.hostedemail.com (Postfix) with ESMTP id CC50C8019147 for ; Tue, 9 Mar 2021 08:04:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j30trE3Gx3jX4N+6Fsir22+p7RUNllwpJeLjOu60oSpYLFW0/oiRvJgCjLB1BxJL/h5nDOWCtKwG52Sb2VwucScsIdQJLmqDjIwxfMxM8W3pNzWTFhJ+rMOKDA57L4eMRxZt1ENpOW015Fa9gzOEINF6eLc1jdZsLWGj8nX7CX0ieeyRh6LEo9JSW0tGW1hdr3g8IRrAjD2ItpTDdrP37+8feztq+xp4an8kvu6ig7O1GgfHJQoNLsYBgBFBv/QAt60vihjARvx/0Uv2rArKfNhrDrfZBXJMnJYUHwCMcs3IRWLp/M1z6n818IQDJYAGkBD2vs3/SFP2B58xpdSRdA== 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=BAP5eGj196itQT+6h6oG7CKJMncsxWZSup9LhBVScPQ=; b=BaDsCd2lhEh5e73r4JAZB1CzghXh6ZoB/ibYjOsbo/inegg7Q4YQeH5CsKRN7IfvXC0tRtn1xLxs5/pUoSOhclblPVtsYReJTvmHzJ4kXqwdQtIWZdu4Gs63gG8Y6pdyKDKUEnj3mM57iZF8cdHVCmZG3c68cVqKDkpuvTl5qBrTIYreTyQDcYyVyHbaymP+RjJx5YHshJqz8C73tJgmOJIU8WRNZaaATwBI8SlyDcZwPpo3YcPLghGS+pmDe/9jL3bYk5UoqYU+QmCV7Doq3RIOw/C8LkhwiK5m7ltOK7xxKPQODLLNYkPodd4jo5shHKV5EpNEAKHZGeCFgECZAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BAP5eGj196itQT+6h6oG7CKJMncsxWZSup9LhBVScPQ=; b=iKSI0MPDk7yTjfzZlHbD2wKDxRX+/WxqCg+TBlcnl40IsfcyXCNAdgVqzBQXL90OSKszyft7y1DJP5eNn3qwmpl0tpaBzlv7HjLayIt3zNLu4OVP9O3GUk68eQMNbjIRYFkcVHwY/LkwUR0mM5jtwvAzYW7p/mop1M9DdaEeFTw= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=virtuozzo.com; Received: from VI1PR0802MB2254.eurprd08.prod.outlook.com (2603:10a6:800:9c::22) by VE1PR08MB5789.eurprd08.prod.outlook.com (2603:10a6:800:1b3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Tue, 9 Mar 2021 08:04:41 +0000 Received: from VI1PR0802MB2254.eurprd08.prod.outlook.com ([fe80::e4c3:b366:458c:c613]) by VI1PR0802MB2254.eurprd08.prod.outlook.com ([fe80::e4c3:b366:458c:c613%11]) with mapi id 15.20.3912.028; Tue, 9 Mar 2021 08:04:41 +0000 From: Vasily Averin Subject: [PATCH 7/9] memcg: accounting for mnt_cache entries To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov Message-ID: Date: Tue, 9 Mar 2021 11:04:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Content-Language: en-US X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM0PR02CA0013.eurprd02.prod.outlook.com (2603:10a6:208:3e::26) To VI1PR0802MB2254.eurprd08.prod.outlook.com (2603:10a6:800:9c::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [172.16.24.21] (185.231.240.5) by AM0PR02CA0013.eurprd02.prod.outlook.com (2603:10a6:208:3e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26 via Frontend Transport; Tue, 9 Mar 2021 08:04:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7fd6177-658f-4782-c37f-08d8e2d1fdf8 X-MS-TrafficTypeDiagnostic: VE1PR08MB5789: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5F8og98Vu33Wgc4OvuV3SoRrFEUNmhfyBDxKzos/xgVBcyx43TWkGyua4yC6gaxd+faSxu8qKF7ToTN+WnlK7P1ggKoRUPElg2VtomxJrwlZOp9BMHf/ApwXK3s4FK2q6QLwP6rojFfVYFS/TdjS9sSSbjQ+zhzxiVi74UdWNspOos6Bjh1ns3G9lZDLWz45r60ZT0rYDL39hXJMCgJJTYf9oo9R6JUIYXcZcgFzb02a58j+gqZfYXiIA5FYZ1SAUdYMxO1L0EB5G5AuEM4rs5hEbuE17wZu59Uc3rv21eGNbCyAp2x+hK/C4rN7ZUrX4ZP3d/Gb7UJoDr4hlz4xcXXt7KVfTqO+FazXqLwmfmNVz66HUXfXVvy2aDu3Rz9QpWEdUezzSUHPmn3SAGd/lhRGhmglvQusNmfWRllmKq3KrY/PoRDnV/xOVO6hGr+juIXAUdNtyKpVrDHEcZz/vFCXiH+L8Ko0M4B3H1aKA/3nhSpGo1ACPPyzKYx1ErjMO6D2s6RQlBqp8RVFBY00YAocwmmbZfwHAWl8izaPRElpSSmgpABKR9n04oiz22bHdKOzpcUZj3spc+aLMFoHUapm/RFs48tyKm7KvbkaWI4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0802MB2254.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(396003)(136003)(39840400004)(376002)(26005)(54906003)(31696002)(66556008)(66476007)(66946007)(36756003)(4744005)(186003)(4326008)(83380400001)(86362001)(478600001)(8676002)(2616005)(5660300002)(6486002)(16526019)(2906002)(8936002)(31686004)(16576012)(316002)(52116002)(956004)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?WJ7uWleKIfxUZJWXCTBS+UqX8xId+0?= =?utf-8?q?X+uYD4Od/qCo0dKkWGAnCgXzfKfgggh796AiHlCSoeblIY8GVtPEr6Y0OPBcszVrN?= =?utf-8?q?JIBYlIYQ2lg9FQEK2NecoeWB7fLE0wbOfOHycQvnT7H5diODI7o7QnjEoa9POl/EP?= =?utf-8?q?mVFT07lv42UFKGi0b2wIoeT6pceiNc6QPomsyQ4CjVfz15gePY+lE8Id1bnglHKLw?= =?utf-8?q?x+NHw0o8QGItzxs/e0PY9/OH5shZH1Ji1BFzsH2rRRzwVX4ilpsEqSYUlvspPh1Na?= =?utf-8?q?6AiqPhxw2KMBTW53fl0vpiJuPeAW4PQJ5mvW7u2up29vXIvBg0gY/8+GgMhDwg0Qq?= =?utf-8?q?97tIcrHMgeyjGFZyz43hQL+58vcAqU6qdeB8dizclOEvgDMsQurRu0YQv//jA7qD+?= =?utf-8?q?vS+mi0Wx3tzplE4gnuvgpEqaS0WKqVrihT7fqazSFWo2pdRxiOKdEJ27/jVf3FwJG?= =?utf-8?q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4782-c37f-08d8e2d1fdf8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0802MB2254.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 08:04:41.1295 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s4PW4pEP5EDmOrTOG+uC+r1kYKoXkHO18awIoXGFiQGb/epDScnWut1vR4kOcnRqrbY32qVKM2bwH6/qeRXrwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5789 X-Stat-Signature: 9kofnpmqctgf938udbohxkphsftb5bbj X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CC50C8019147 Received-SPF: none (virtuozzo.com>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=EUR02-HE1-obe.outbound.protection.outlook.com; client-ip=40.107.1.128 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615277079-265699 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: Objects can be created from memcg-limited tasks but its misuse may lead to host OOM. Signed-off-by: Vasily Averin --- fs/namespace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 56bb5a5..d550c2a 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -203,7 +203,8 @@ static struct mount *alloc_vfsmnt(const char *name) goto out_free_cache; if (name) { - mnt->mnt_devname = kstrdup_const(name, GFP_KERNEL); + mnt->mnt_devname = kstrdup_const(name, + GFP_KERNEL_ACCOUNT); if (!mnt->mnt_devname) goto out_free_id; } @@ -4213,7 +4214,7 @@ void __init mnt_init(void) int err; mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount), - 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, NULL); mount_hashtable = alloc_large_system_hash("Mount-cache", sizeof(struct hlist_head),