From patchwork Tue Mar 9 08:03:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12124307 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 E626BC433DB for ; Tue, 9 Mar 2021 08:03:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6C73F65295 for ; Tue, 9 Mar 2021 08:03:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C73F65295 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 040328D00BC; Tue, 9 Mar 2021 03:03:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 016C28D007F; Tue, 9 Mar 2021 03:03:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAB328D00BC; Tue, 9 Mar 2021 03:03:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id BE79E8D007F for ; Tue, 9 Mar 2021 03:03:54 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7CCBF181AF5E1 for ; Tue, 9 Mar 2021 08:03:54 +0000 (UTC) X-FDA: 77899597188.04.CA0CB37 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130129.outbound.protection.outlook.com [40.107.13.129]) by imf08.hostedemail.com (Postfix) with ESMTP id 0EBCF8019142 for ; Tue, 9 Mar 2021 08:03:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kS1uw8sBdvqHppO3a8O/2popHhBiOIcrPCd/2xh91elFqkAy7dtDKGR7fNXdA1LhJEsTjuM3P9ro16XD2/9i4XzISnr45b1gclE3lYsA9F9FAZY8S6BzTwkTvDnJ+qdUyKjOEQzYQIX8GezdRctenI9jv4sSml/iMN9i9yE75pAehYhsQwb+VvMm9ViIOKXABqoHfbQCf5qFP0xp4dc8RJV6TTDL7xsVOEB+JTScd9aVGe+7/NgrIoHbWxV87b1ADAXa5hqBC4yXg23VYww6JiObeP9djdZX+Q+6kF02azFFkXL8OM6l9ppJ5F7I/BufaCnjHPGiRH38f6I28hLZkw== 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=C5o8mkc1Zj8mwSqxNhwynoe0HUtQdQ5ByM2Mvj+TwRE=; b=RTtWSzCa0OPCPXil+Znl4aUP3rs6hXYE4Za8r9EKlF/VG29q9FMyV6JH+UMsEKW63wKoZ5+bpCVN8d5KcENYLaL2NIEqLDAB/mHoxrQnzsBsF0YiVkrj8swK9cXTLifOlIvg7CpE6eEsrPETP5H5pTVvbOy68OMbitXXMheyymPUNa0Agss4zQtKSPi+/Vdu6IgymXC7ycd3RIHKaLfrHcXzXTGuSXULuZ3y2hE+YpcxnH13X24NupM8Gxzo8szVa8muyh4SL3A9q7wSLMw77Q1IA32SORbI7QoZpxH5gu4+nKOqrmHy74/6g5ViRGNWXseOj03l5e0yv8iN7LZYlA== 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=C5o8mkc1Zj8mwSqxNhwynoe0HUtQdQ5ByM2Mvj+TwRE=; b=DkMpIobrjefjSXZtSghiTKUWp4uff6vm9fpRtU1WBWcV1PYzM+ewJM1bLR3an8Bq2tdAd6P0h4wLKoIvzr3EYp2erx8PYrHBLGK802XcrZ3TyukFkBavAB8AhbZOTsAmil+ZhSLg58hC7gnvPvpY0Csrusg+Ao6IYplNsdq0ikE= 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:03:51 +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:03:51 +0000 From: Vasily Averin Subject: [PATCH 1/9] memcg: accounting for allocations called with disabled BH To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov Message-ID: <18a0ae77-89ff-2679-ab19-378e38ce2be2@virtuozzo.com> Date: Tue, 9 Mar 2021 11:03:48 +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:03:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d5c8acce-eec0-476b-aa27-08d8e2d1dff3 X-MS-TrafficTypeDiagnostic: VI1PR0802MB2511: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qKQ6Ut/YpwJBbutVJs3eyP4VSYIBHGj05XeqlVAmkXhT5pzweQ1JeaUsEmrFCUngYeHDYhUZOCqm+iSyApwG1hZaRondVbjD4x2V9irNOuWvtqecAbQwqBP47nU0mih9hIURrXqzGtGNdc1o9cd6k99yei5gwKDksloLaJXzNpUVj9Wngoou5k33dU6IHsc9V49y3pbQ/stOYo4GUEctKeE14pF8ktCTFvqD8Aq+ZscgtmCOQ2wmwDKZbb0cTSGQ4MfBUoOrenN7rWXgI9MgehBvDptgG8UFwTsWfVSQGLEM17It3xTAX6jtgwmuZH3e3hlKxuWrFCyVqUWiH7qF6+tboQ/hxcFd/21zE7SPh33/XzDr4n9cRx+C8MRZGxeIx+FEH3QE/sTvq2L7gUy7wVreFBRHbjPTdOCduIuiSmVrqCnz1v9qE2kQqYYuYI4RhKUPCiJdn91UzcV9Pei1HdjTmlg4fYoTLcGLw9MgEKIA2wlJmZRQXpc+hTltOrMnHwiBEPgR6Uiahw4AJPLasM187otYsNRBjCswf4Ez1z35C0rgWWm4T3A2lNTVgG/Efey66XpPrpBjuFlZUHIgxXFHMkGknOop+3A8j/D4Lfg= 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)(15650500001)(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?q5bHbk0Xq4+Pxd/pu8aedXyP2SOtNt?= =?utf-8?q?5LyDAzdJkoa9yt6/TRCaLbG4cd2VhRw0LsanOvpCq9CMuDJo7qmTzKZralkb/L3mm?= =?utf-8?q?/sz2rhFx+BctFJIZfoqVNkruM1VIJKAoys/+i/npEnknsYqaVcrq/Kq4nS1o/tC27?= =?utf-8?q?96BG3O3s/BrzoRHKQSZkufrr+iEDx9PTTu2cgwLCOC4M2gSUeLZy+YLrzAaMWOoHv?= =?utf-8?q?HxeKQrtqxECIYhZYsofhSTvq8mfWyCOfQ8nA71xHrL59/TxRysR5sOh0iB8RMte+a?= =?utf-8?q?sSMltpy0gaBV5yirWA2pV/Dj+1FiWNxPHStb3zmYB8UhSQn5hTHfVagRnbjqs4/9c?= =?utf-8?q?mYVIfc9kG4RSDrP4DMmYpe4rCQgNx2ADX8WM/uWSLx73vEFdhuZm3O2WwawnMAaZX?= =?utf-8?q?a73YJW40ysCXB+AuzER+MYnbsWZpR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-MS-Exchange-CrossTenant-Network-Message-Id: d5c8acce-eec0-476b-aa27-08d8e2d1dff3 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:03:50.8684 (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: xp0i88TSW7l96J/t9JQRTUWcJc54gBAh3PbRCAYgBaLo+otAMc8AmOMoeGzhVKMnnE6JP8RADvCzwyYdbNSxew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2511 X-Stat-Signature: znoxqitj1x7e3rigew4guqge8teyepf1 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0EBCF8019142 Received-SPF: none (virtuozzo.com>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=EUR01-HE1-obe.outbound.protection.outlook.com; client-ip=40.107.13.129 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615277027-202958 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: in_interrupt() check in memcg_kmem_bypass() is incorrect because it does not allow to account memory allocation called from task context with disabled BH, i.e. inside spin_lock_bh()/spin_unlock_bh() sections Signed-off-by: Vasily Averin Acked-by: Roman Gushchin --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 845eec0..568f2cb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1076,7 +1076,7 @@ static __always_inline bool memcg_kmem_bypass(void) return false; /* Memcg to charge can't be determined. */ - if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD)) + if (!in_task() || !current->mm || (current->flags & PF_KTHREAD)) return true; return false;