From patchwork Tue Mar 9 08:04:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12124321 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 A7EF8C433E0 for ; Tue, 9 Mar 2021 08:04:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20657652AC for ; Tue, 9 Mar 2021 08:04:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20657652AC 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 A50648D00C3; Tue, 9 Mar 2021 03:04:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FEF18D007F; Tue, 9 Mar 2021 03:04:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 852EC8D00C3; Tue, 9 Mar 2021 03:04:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 6C6808D007F for ; Tue, 9 Mar 2021 03:04:52 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 347D98249980 for ; Tue, 9 Mar 2021 08:04:52 +0000 (UTC) X-FDA: 77899599624.14.5215A12 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10115.outbound.protection.outlook.com [40.107.1.115]) by imf04.hostedemail.com (Postfix) with ESMTP id 9F2FC138 for ; Tue, 9 Mar 2021 08:04:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5fcqg6x48afdt/MwTDf4vGqfqJxhvaL/72BQi+B9Z64HS0/T/dXjfLtABQf5Obpg33KjT/5y1UOy2ps32waJ7Z5ymgXmy7speIKcS7dcpLTq408PTFDwoiyOniZBYNDufU0VliX2lrUpQD1emq4Bw/WVocZ6DwPSeTR5lKHbQ4Uqz16yV7jCpbgZGImHqpui9f0rQHLyvr7suBfVJQTWAO/tIwJtw61qjDVDnp5rx6AgHqUWf4c4/mCMQhjGXxCBip4Eopl5Oj3QTxMnyptizmNEW7A+7vuqrgU35mk2dIq34W/QYyKJ7hCHx9gAChUiWanD89m6U3ydPnBNQjE4Q== 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=lvOGfhU67Ne0x55U1mi/eYx3RQi6tluzUKRhpEayLOQ=; b=htqVM9LoYTJdiML2nqRENLcuRAVcfaMGYZf3CGnwep16SGlqM48PYRyeH88u8ls2so4jYVWf2IZhlCSdLnhBtseP7SGEq/KE5uHY0B7/kOdDK7ArYP6JXNJfJyGCmeg3N6c436FryVUl5V9G5jAT4Q4q3pA7KCFUDEXSk8ZBE3DdGS8KgTGJJ7/0U8fmPUvlXJOYxv+v1GzfNcHTmJ1UoEp2IEA9Kdyk3gKcHOCVsWm2ct8JupU4o5Egw3TMoAUTE7uld8tbLe0YTBPB1vwy+BIqaGYnPblmRVkvj6iFviDVLF1H+wOBNa2WjwlmWcyjJewD9WlZdEdMZnLErMTPqw== 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=lvOGfhU67Ne0x55U1mi/eYx3RQi6tluzUKRhpEayLOQ=; b=DoOD/d2xRXZgq6ijyDzejbWsDTKzgy+BN6kj4WqlAqakaRvL6hjpP/ysI0/aIQCTA4qqCsmJrYCGEQle/STjhDD1D5iXQB7Kz8H+frxGHtEbY84YIkVZFYjRlDhastTkGPPJZncc2PcnrR75dwidXtX+1VPaMKeK63H1sVqu8gs= 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:50 +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:49 +0000 From: Vasily Averin Subject: [PATCH 8/9] memcg: accounting for tty_struct objects 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:47 +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: AM0P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::27) 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 AM0P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.18 via Frontend Transport; Tue, 9 Mar 2021 08:04:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf97c14f-3276-4124-25c7-08d8e2d2032f X-MS-TrafficTypeDiagnostic: VE1PR08MB5789: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LJpJ+0JYzbfC7J0ifI+cV3c3JabegO/vNmwXzQqEvCjFdn0iHTjk1e9FmuZbAH88JKGgkVb21GbWm3tF+iTOgb10sYh5jBtFF2A9LKys2iBNHGXFOnTpOUsK+l5EtUXGMicO9H+wLW4EXVu6FwNKfYkzrTclkUemSayhSSM83NrPuddmY5vuBv1ZmhsAJnogXQaHa4NbGK9Zhr9Lx7KjVrAPffYuAjGjGJVPUMnucw4PIKefNGZA56FkhwTj25JexByKxg8LBu/T57FZA1QR5kaJnsCc1ds7ncK96kGDeRhcI3LiPdCCPxI5QoqsepFqbgPmnlTVrqRblvsY5+OFg/teuQgElWvvr62hRd5Q2uht1915E6o7L9c+1NIX4jRMaqjQsfz/qkdmlxWZn1tmQPe58hk6mfIag+LdzA/SsEO6FQCg+6JFD9p8CIZRNh0WOa+MxIO+rgejmyowNe5EkeMy5Wu6qNDKEvN0MuDeM8X2P1XOkc19UWyTOIf5nZ4lEN/j8CE9BkN7ShCTkjH1joAUVfPzwYyNcJzCrf+M5DNb4ik39AHC0Ac7ew2pVicKM/wD1fyr1jflBAp8Ee5B2Utlf0Xb/eTp5dnnNgVa7wU= 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?+AUp5bUQacfSZrR7mo3WQoTG5oUKc0?= =?utf-8?q?2GOQF1KR2E3K/CKBeTvMIsuHs3g9W4qXsQyfUJstv7dB+4ND13lLb+OTaxeMwUTB2?= =?utf-8?q?Qn4DSpc1LOyw0ZVIr0aXBcvjMCDL9T7C6tFlaVzwxAVRlqfIDw0jWI5nXYlOJKFkD?= =?utf-8?q?1vNKjg/Y8ppybvb4U4eXzjYpumWfvCvX7Vjht3Vp2bDWL+leGbsCkb75/2ns9OQLC?= =?utf-8?q?toKbVWAIScpd9XLCOf8O+a9xKTcwgzC37eziKtJec0aQhBWzkX/ed2igS0yBoWaSh?= =?utf-8?q?8FfaiPntoQg8mr1vUbiqHql3y3ybKRXopH6jFhNsSNyVDAqk9Xx9AxC1DJyfurwkE?= =?utf-8?q?OEX4pZTUJSN1QRmnKo7h/PlNshhgNrM9Y6yiWCPqZ7VrtsmBVhcvA+77jg2xpnebr?= =?utf-8?q?L1zlhoBCoICroieQKx8V6+CGwqiFSp7fIpe0d8mY8R2U5eoRZ35k05vMAD58SJRsG?= =?utf-8?q?gcBpkf+178eN/aXP9LBHD/6XvFzl/qhp2vNbbBXkekU9EdvwlV7x/OWLBHTwoHHgD?= =?utf-8?q?GxTkl4XWdckUTVFvFRoP/AnK+EcQ9aikjO9jMZgppHxlXgXMMubxWZYwmO/FYjhPq?= =?utf-8?q?G9vop9bXrrYc1BGlAd03DBEXTMle0WW48hPA6XTt84L21BwHgp0mFJo/8x5SvYgY/?= =?utf-8?q?koTTF6cPRmMpZLWUUFuXJWFl0RNqVOSizx4BzkoTecRv18zhJ5m5YalnEcBZ1p0K9?= =?utf-8?q?PoYvlu00fyZAWaoQNqy26sw+wy+u7q0a4d5hdKfI0qRxwe+WmX+q5NEQZdFtTO74N?= =?utf-8?q?a0eA6N/gGCQUrXBmtR9M+paredGve+0WZDTIl7RtnCCr3orEwUBwus2foBCLGCtqq?= =?utf-8?q?8WnO71MHbkcerC46dS47w1nK+vI25UvfCbVEXZxgRcTErGfd6gBUlRVSCpCyAlxlU?= =?utf-8?q?ntMB7u2oSf3bNod7eTkjk7I9zwKzsC6Hy6o9/9f1WVnAX33THmiK8wd4vlZxt8Czq?= =?utf-8?q?uCswZ/eYDaajOE1oJSeqTJcDky4Pq4/Hyq2/uUR3EbARGtNYbWk00dhGPNThTPSgW?= =?utf-8?q?3A1bKfManbwbiNrmNpg4/y7HnbyFssxDO2zNc0h4+Ln7u+i2P97VhXKkIxc0bw9aE?= =?utf-8?q?SyETONqRBaNfluO67nFcBuGpiSiROilsDdhcYP7de15QADJevbM9oOxDV9CF8XnmR?= =?utf-8?q?4/vQ91gKHpIBH8ARPrsckXPC03nQ2nBW6b4HkfUZOoEAyQEIr4uDJEJOWoN04ZrCV?= =?utf-8?q?F9a9sNPKPca9q+K1rPpDzjyyzy2pq9K+CXK17pYf7uSkr4s98Mr2f5UFWsw1uKUp6?= =?utf-8?q?4nn2bAXoVDpbUE?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf97c14f-3276-4124-25c7-08d8e2d2032f 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:49.8885 (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: BJcBd532SwBQ/BQYMPtdZZpEBpniAhObyXJvN0+1onZxrVM210Ee+ZkCHaF2lD7d2hOppXt77YPvC2di4c3WOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5789 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9F2FC138 X-Stat-Signature: dfa9ch3qnpgsfezaxcg3ygyszik59znw Received-SPF: none (virtuozzo.com>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=EUR02-HE1-obe.outbound.protection.outlook.com; client-ip=40.107.1.115 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615277090-499194 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 --- drivers/tty/tty_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 74733ec..a3b881b 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -1503,7 +1503,7 @@ void tty_save_termios(struct tty_struct *tty) /* Stash the termios data */ tp = tty->driver->termios[idx]; if (tp == NULL) { - tp = kmalloc(sizeof(*tp), GFP_KERNEL); + tp = kmalloc(sizeof(*tp), GFP_KERNEL_ACCOUNT); if (tp == NULL) return; tty->driver->termios[idx] = tp; @@ -3128,7 +3128,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx) { struct tty_struct *tty; - tty = kzalloc(sizeof(*tty), GFP_KERNEL); + tty = kzalloc(sizeof(*tty), GFP_KERNEL_ACCOUNT); if (!tty) return NULL;