From patchwork Tue Mar 9 08:04:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12124313 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 B5E60C433E9 for ; Tue, 9 Mar 2021 08:04:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2CCE652A8 for ; Tue, 9 Mar 2021 08:04:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2CCE652A8 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 87BF08D00BF; Tue, 9 Mar 2021 03:04:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 852F68D007F; Tue, 9 Mar 2021 03:04:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A5258D00BF; Tue, 9 Mar 2021 03:04:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 503348D007F for ; Tue, 9 Mar 2021 03:04:20 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 147858249980 for ; Tue, 9 Mar 2021 08:04:20 +0000 (UTC) X-FDA: 77899598280.26.C0337DB Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130131.outbound.protection.outlook.com [40.107.13.131]) by imf24.hostedemail.com (Postfix) with ESMTP id 2DFE4A0009E0 for ; Tue, 9 Mar 2021 08:04:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TOB/2mwndAlyH6KzB0QLhaMBSxgYmVbBC+IWnxLwGlG9yi4vnuUBtCjX32sAmXevrfP11WicnbPj8m2LiTiTuYLZ+KXwEJjtEJoFJOTyc0KS2QiWiDSKgGBoiU//Grp5JkJSTTZV+1rX6PHW/hqIEX7xa0cuWBO6PkrIZbzHCX3ro14O/fnK45zZky0vfS2lErjHwg6V+TbF2EFVt5SEUgLflEmutEsUW/Rlb+IA7nZEi/g20Opyplaf71cNIFzmXLMc+nwZZ0IpYhx+cq6bwnqclsj+vHdUTqObKRQ9WUj4giEZttJmU93J4pX7AWfcT0HX9a82bQYay4T+8zc9qw== 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=IYB3aQq5E5HSxpjVSG+RHcLXuDkNoT5fOy83l0MSG1Q=; b=BjhxwbXL5yuC9LIZ6WYapUN7J457+ySFg3q8PQXGYnXZBJ2ptm5geenr8Isqx2UMFHwylI83Fe8DlKbcXLjPcvr4BBbglIUnAppGVRKrh+0QzELKiOQzC71cQ4OykKxvqf0w56Dj7eKZtgs2rxe8O0oZpG81px64flsv0/to/BHYyJ8f8MHu9+nuqeG0MvGKazNlYQdgpD2X2rB5xLJoh07/261SVAT554zW7kDH4Ex2ut/7rwtbA72g9dTomjfjiVFRyTVKxYic5DA5+2dBOatYPbp0sFNcdCgIGGEFKHf3CGoUtuODf8cp6NK1kILcaZLlTG9vOtb1Bs+OiHbOgA== 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=IYB3aQq5E5HSxpjVSG+RHcLXuDkNoT5fOy83l0MSG1Q=; b=k9S/36PajArzsIo02GjKwQZKxmP52OEds/5ZnENgAWXME1kSyNJnxaYOf2qaR7QWMd5BWy0jViliduedeeS/Xup9xuUMzvTvcmSb/Mw/M7Ru/D17i5ozCl3O3bijo0+HFreYaY50VqkP5d3yo0IQLez651yR0KMVFOWHxMF51Yw= 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 VI1PR0802MB2511.eurprd08.prod.outlook.com (2603:10a6:800:b1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Tue, 9 Mar 2021 08:04:16 +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:16 +0000 From: Vasily Averin Subject: [PATCH 4/9] memcg: accounting for fib_rules 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:14 +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: AM0PR02CA0004.eurprd02.prod.outlook.com (2603:10a6:208:3e::17) 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 AM0PR02CA0004.eurprd02.prod.outlook.com (2603:10a6:208:3e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 08:04:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5daca13a-0ad6-4586-647f-08d8e2d1ef28 X-MS-TrafficTypeDiagnostic: VI1PR0802MB2511: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AQsP0HD960peReqG8hvynQS3s3uC4sDuEDRNHkrbrRdFoXu4j6gn/2SBkjb9XErO/FkejlgVtJH8Ev7zqKwv67xZ0DApiVmiVQB9AghCzqhUxsUQoArlf9e++i5aCpdTgtZvsjK2u6n+tqshlK2j6Wh08yQCd73w89wwYdIao5qCQmKbudyB9XYaEnTs2DTIWcnT05JUIYxSpJthyEw+Y7q1tUz+OANFZLQL3IIgr+uNMZwbCXLCUg5IhHIWQ0okdoMdYUEhPTvIQOpYeTf+ba3ZfKSdSnLxYNO/nqXFnYkgf6yHuMrSyDYQhW8tQtP7YDxrmrSGrxrn+XPNXVwU7JLX9g7tn/oZxsQhn19DinkHi+T/SHNFBhkkGVPp4DjaZ6hWomtPdbuF8SDkxo2mIe2gPo5IHgbCrYf4IL6FS3xPbzUuyEhhmDQPPssk4Tb0LgaSWNuSYoILD8XzzVqGSdHe7JMBZ+y5S+RTAr3OzCUBKnmAfFHbVdLLeg2JNhIP4fxd8xjkPMhWSXWpZ9cfOXJSfEZNGP5/G+8e0kZIYXe+9SGWKv3elHNT4RjB6Ayx/dOfqGf/GjzJc6lrDgxBpGNzfVmIWySNhPNQ11ZDZSc= 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)(376002)(396003)(136003)(346002)(39840400004)(366004)(16526019)(66556008)(86362001)(6486002)(2616005)(8936002)(66476007)(5660300002)(478600001)(956004)(4326008)(316002)(26005)(83380400001)(66946007)(4744005)(2906002)(31696002)(8676002)(186003)(31686004)(54906003)(16576012)(36756003)(52116002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?WsHq6RDRxRIVqGAUk9kNGniJjGyf7J?= =?utf-8?q?yt6p7QLlkP/sTGah8k/iUttOc9boHlu7e1UywpybB6uP6KEY0E8re+Cs+XdJuBrWF?= =?utf-8?q?qqr8tjrZlw9GBFrB3lQL/9mu4Gr11AIEBfDzjBLqdZeyELMZoPQF1uPN9CmcMSuzs?= =?utf-8?q?PbDJfG4GAUX0oUObSNSQTTWeex7Vjxq70WSetYNwz3E36Y/9O6dK2yQiYqXG9CBgn?= =?utf-8?q?r5wqznxjYnacSXcgoYMYMdpl8fWlQHQ7iDjWRFZVplSMfw+n09+zQMAo6y+duSqmQ?= =?utf-8?q?27PzydG1o9RIaoV0ewBYjvIKT8KBiomPqVBxRPd+8mdiBM1m6axCBMC83vyIvSDsh?= =?utf-8?q?m5Tc8ySve7O/itJf6tHTA0g5trBK+qHzWAuFmRR2SoSeN7I0HZOQJJrOOHsp4TYwf?= =?utf-8?q?EgISUHc7Nw5oPY+EYNQoMonsaHm7AhFTrlrhcb8hOIhg8ACqqQxEbYz825Ox34Mhg?= =?utf-8?q?kT0hTZLEVqngdbxH7yDIbV8T+uN4PX9N+SgzECljBP4MUj+YNRtIf1pfREXyc40c7?= =?utf-8?q?nbrJ0wFQcB3Fm1Nk0G/O/MJIM6+0q0EzxrI57mE2HnASBVR5t2XA9HbaMSXwH38SR?= =?utf-8?q?BxDUGILb9KsonLdR3srOmVsVLxkfejBIM2JFHx0fDq0GFi7DxlQXr/hkhMdAHDqrK?= =?utf-8?q?JTwkbikFzhwY4OZYbqdQGc7X9HiybIogtY3CCDV5ZzsX5Ny43SLDq59gtC5lhcA6h?= =?utf-8?q?MNyE6nKc6dfx1sMFO0hQ9WCQbjS516FcQQ7IIqYazaWXelA4Jegrbp/gwq2wUnfeL?= =?utf-8?q?v13Rvm4t8ZgXiiKw7LPe7tcluC1RN30QP4E+AU1qhiJGbeaQtNbivQza7FCS9db+W?= =?utf-8?q?e/oWBinN/nyopESgXYEwVXCPmYkXyBhdUqvB8steq68X1KjxkPk53NPEC6gISIW1B?= =?utf-8?q?Vl0mVLzbyY9NurYzx1pYwH9yICcaacmma35829CaoDqXSHgCN3toFYBTmRuV2Kxbg?= =?utf-8?q?YI6oLeUO8gOeMPa8WHA4J8LnhtnML0k8Kwc6mnhlyrMIGI+4QqOu0bQON218AEdrA?= =?utf-8?q?sRrNmhSRyDzHZ4uDk7bOL+zhk5aoKxN7e3L+RucLJNWeLDYUgAAdt/i4C7rxBxx3M?= =?utf-8?q?5lOjaphn0OvJdO3F4my05UgEexPGfCO3tuVfkEgqkPkPgx11pwr3OMh0eLI2MncaB?= =?utf-8?q?d/80U5jHoRkMyn0TZlfphCPYuPLEXMH3uqPb3zIKsOp2/lx2lbusmdubkB0VVnBxU?= =?utf-8?q?l1tyKTUF19Bx9FYLhtZAwTPhpZ+inSwMJc+aa3ajFa5ROCwi3G7CaVajbt532fXmh?= =?utf-8?q?IH1DLzTool29yl?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5daca13a-0ad6-4586-647f-08d8e2d1ef28 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:16.3398 (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: ninxQwVCvzpSjxluAV+petqXUNI1tlV7mv7X2Xbm+qfXnByWUedmCCZIvS7YruvHx6YKjCBys9el78FHM14cjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2511 X-Stat-Signature: tj6tiky3e5t9atpx1bmbhuk4x67dj7c5 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2DFE4A0009E0 Received-SPF: none (virtuozzo.com>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=EUR01-HE1-obe.outbound.protection.outlook.com; client-ip=40.107.13.131 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615277056-398128 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 --- net/core/fib_rules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index cd80ffe..65d8b1d 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -57,7 +57,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops, { struct fib_rule *r; - r = kzalloc(ops->rule_size, GFP_KERNEL); + r = kzalloc(ops->rule_size, GFP_KERNEL_ACCOUNT); if (r == NULL) return -ENOMEM; @@ -541,7 +541,7 @@ static int fib_nl2rule(struct sk_buff *skb, struct nlmsghdr *nlh, goto errout; } - nlrule = kzalloc(ops->rule_size, GFP_KERNEL); + nlrule = kzalloc(ops->rule_size, GFP_KERNEL_ACCOUNT); if (!nlrule) { err = -ENOMEM; goto errout;