Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1806371imm; Thu, 2 Aug 2018 01:04:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjL0lpdYHQb9m3kVp4XSMHlQ1YQ/2Xo6HRE4aNugnAyPU+Hh4o/yNJXRtOpGA+7Fn40mur X-Received: by 2002:a65:665a:: with SMTP id z26-v6mr1630805pgv.193.1533197063830; Thu, 02 Aug 2018 01:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533197063; cv=none; d=google.com; s=arc-20160816; b=QBf8/rZeTgsUibr9iLq4cLwnMguw3TFJMgXh5t/60u09Zj4dqPhehz9mXwXU0dfkbA MLmD2ms3/Ga49g0cycji5QEaJVq3G5T1ffyznP3Z4cOjTLij7gm7++9pPcET0tCUii0w Wy7ZCh7PJQgbq8Kov6p3sB35sh+hWQ2YfQWAyvuSoWx2Lwt35IE0gn1rRGggiPgesG6O eWlJft3L2B67HDv1hQd42d1aqUMy63xMpnLOt8GSoGtBZpSUPCjix72XX6cWUoqpEECI CGa0nuIhIo/0kEdGu20bdCZPUhjuDqwVqs5cicYytUmcdczQ0MON7J/na/5lysqSz5nb bLSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=TIw906ph0bI5s0nDS6RhBXdJmz6EIy/+JD+n7yyyfvU=; b=qLyW/ZpgoIpCOyfXtGKQIiIe8W6+xVq9pSrrJOV7WCQl4UJJc+ZydJG1H8gHbPxOVg ojrUybf1tAHt3vx2ThsfhOm4pFpJKWOztDnyNKXyL3zdDYnjbN7z2BcvvyLlauRbQq2i 2XbBjWAg0cO3soSFqQal2GpzFVz524KMzGa6CECaEfz1u6yTvDZM5Km2473s7W7V2uHC 41kN5VD+IHQr9+qv95WJtwahekzo5U1G0y/heRNxSLGct8M+PMkUVTEz8GOHWkx45jHN yRiQ+hABPBDsliMQbbORSWlCpGu2H954luFHKQFdP87CB7JJ2GlmIzZLZS78K9+RNhmq u9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=GCB2DSzw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4-v6si967588plm.181.2018.08.02.01.04.08; Thu, 02 Aug 2018 01:04:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=GCB2DSzw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730644AbeHBJxJ (ORCPT + 99 others); Thu, 2 Aug 2018 05:53:09 -0400 Received: from mail-he1eur01on0115.outbound.protection.outlook.com ([104.47.0.115]:31824 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726307AbeHBJxI (ORCPT ); Thu, 2 Aug 2018 05:53:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TIw906ph0bI5s0nDS6RhBXdJmz6EIy/+JD+n7yyyfvU=; b=GCB2DSzwL2z+ULrOUaHAga/vMsBOAsdi2k6z8J/DTHHVxxkn+gYYHtR/9xhaE8dBPykDllo36cIPNf9lTLJ71lE/aSg9W9byFWuWhZJhYubRavuLdyak8GCkEH2D1H7SwYG2GG4BdWPrMtGCVkqoHCSWyBj4YEiqzke2Vo9O54E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.25.169] (185.231.240.5) by DB6PR0801MB2022.eurprd08.prod.outlook.com (2603:10a6:4:76::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Thu, 2 Aug 2018 08:03:05 +0000 Subject: Re: [PATCH] memcg: Remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure To: Vladimir Davydov , Johannes Weiner Cc: Andrew Morton , Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20180413115454.GL17484@dhcp22.suse.cz> <20180413121433.GM17484@dhcp22.suse.cz> <20180413125101.GO17484@dhcp22.suse.cz> <20180726162512.6056b5d7c1d2a5fbff6ce214@linux-foundation.org> <20180727193134.GA10996@cmpxchg.org> <20180729192621.py4znecoinw5mqcp@esperanza> <20180730153113.GB4567@cmpxchg.org> <20180731163908.603d7a27c6534341e1afa724@linux-foundation.org> <20180801155552.GA8600@cmpxchg.org> <20180801162235.j3v7xipyw5afnj4x@esperanza> From: Kirill Tkhai Message-ID: <7a836e47-f0a4-6802-9b90-cc473e5ab90b@virtuozzo.com> Date: Thu, 2 Aug 2018 11:03:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180801162235.j3v7xipyw5afnj4x@esperanza> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM3PR07CA0102.eurprd07.prod.outlook.com (2603:10a6:207:7::12) To DB6PR0801MB2022.eurprd08.prod.outlook.com (2603:10a6:4:76::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b19448f-a777-4f8c-7cd4-08d5f84e60ca X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB2022; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2022;3:hrAmZ2j/pTXWDy3Ak+SKChuJBIdgdfDgzg/w0pZIdyyK70p688mXkqRzkOOW7dB1IEI+FnwI6jtUrYf9R21+PxWGb4FSGRg++rKIRp/7161ZCzmAOTPPTs1I8a6z5w3WOg2gk26nu3XXKvjbjJIgFQbQHCKy66eaGBV0cXgMm9HqjVlaFMyZ6n7+SrsS4/a8EFFhAwivjocvlpKs9ungfvDdiTXkufcmnJWf4APY8A7Sff/u/PkRNp/8lbuhq4/n;25:9gN6RGNXwMgxPo922IvvUU/ss4fIng0ZjI0vPKQEN9mIN8MD46ZBuFeYMEdwGbMqhpLFwFx4413Sy3D1zvds0RUYfWMZOS353goZ1bFvpib7/qL6KGn+vst13NhOupyWAHt5PsXZdKbHdrKU67fv5GeD+SITKlXxYl5fkHssWF/05nau4k1bxnQNRFvtth6p2QHL0lAKcku44N/rDXWFb6S9d6dustc+WWElwpjROj4jMYtc+gDQboGW4uVNh1dVbgtbZZkBhaBZUD3Omd4gdCIoPk2J5VlbIE++q5OsnT4ORDFmko5frj81pD+N+jv/A8y1XHrW5kmEZAVosMWmyw==;31:ja5rNIhsxtrSSDL1fxmGPOHSNw6+jFnqLYg8c+NzPuRaezUHhTJOCW4ZYkylnFdN4jLLGOYIDErRGPuW8GpE1BNuVbdHDrEI9AN+5V322ZCMVAb/LPKJOYA6HENw70sYsj7buTNTx0Av/4dhu2Z+ewnqVJ8HGuOSvyb1q60uAqgRfI4nW9nRuSY+U81l7RFK3OBTarCLKWmAv0JyB/h//nT5ePMcxynBydsQK4j+muk= X-MS-TrafficTypeDiagnostic: DB6PR0801MB2022: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2022;20:34/w4dWYaf2/uBaig54n8xzVUYwVspP0wjW/uyBdiZLcfvfbYE7+8baqz/zD5yKeNS3h4wJIaxZsl7nQZAUHIhuDBJHtc77FPUqzdsoB9mMhahZv+wI6S6ZFb6Hdx2kZdsXDB1zsO4wbQorLXnVR+AK2htfai9P8CF7SdywCHWiNHNK2lzd4K9yU01T76tIwMSJ7UDezRNeuqz4sWAbeRGyrBzy4rlq/egaRteYM7cVLkqMfV1X5rLnzIj4Pv6Du0Orqlc8XDHlA2SPipvCfIyidIPyWv2tunKXoFeekvdtmbg9ThmoC394WdK1q14A1ieVh+fMRREM3Kt8/olNpvGWkD5lTLCx2+q5x3WEHdm4t1+v3GQ+fLh8d6OqxjH7LzCkyJY70ysJ4dwpRoIXiHoAOiAZoboH7kKeAXBIPBsb0zChkvoASjl7Hi5wJVKj1h6I0D+QrW8BCW5B1eUTa5jtS6FhjQ1sup8HkVGI27Vhl/VwkmvA1L2tWDllmCuWL;4:AwcjRefjmdGXf+42imsSiwHX5/g8a/kJQN9c1RBsiHuVvQ7ojAKfEAAs2dcL46oxr6dorT+Lqsi6rH5nl0Iclir9khNaAjsr4bfYvZ53dhnPh+a90uGDJ8rm5i2bhLTb/FdcIOEAQ21mWj510ntklPNordaGgYX9uDJuEx+LreXiiNv1s65NXuhInlR5XLhNwlEvz2T+7nXqHSJbVKjc9V/FHK6DTXcVuUyNpsxuVFUaSYN4eBd8FOsS8wtb+v7sfPBPpzVOQw7YWk4lDa6GtcxC72xE69Of1myXZuGk6rbo+LLYhN79xZRxnID645F9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB2022;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2022; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(396003)(39840400004)(346002)(366004)(136003)(376002)(199004)(189003)(2616005)(486006)(16576012)(11346002)(39060400002)(50466002)(58126008)(68736007)(2486003)(316002)(23676004)(110136005)(52146003)(54906003)(36756003)(25786009)(186003)(16526019)(446003)(6666003)(8936002)(5660300001)(76176011)(52116002)(26005)(77096007)(97736004)(53546011)(64126003)(386003)(6246003)(86362001)(476003)(81156014)(81166006)(53936002)(14444005)(8676002)(956004)(4326008)(105586002)(2906002)(230700001)(305945005)(31686004)(47776003)(229853002)(6116002)(3846002)(6486002)(106356001)(31696002)(65956001)(66066001)(478600001)(65806001)(65826007)(93886005)(7736002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2022;H:[172.16.25.169];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4MDFNQjIwMjI7MjM6Q29rUzBTaXJZVUhPcnRvcExFeW1xUW1k?= =?utf-8?B?TUV5K2xXRE1ac0lNMXRYU2oweEE3NXFUR0syRUZ5MnZvQnVURVhEM2svOVJx?= =?utf-8?B?WlBLQW45TW5FZGxTM1hpQXJlS0tYQ1Nvc2ZaaG9sWGkrUFdWVldzMGYvSFBp?= =?utf-8?B?ZWFoZTlkL2k1ZHZENmc1VVpyUjZyVEtYVmpESHNaUnhXaENRWnZBSFpyL3FN?= =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q53Z7e+T+ySlTNJc4u+E=;7:0TXN+MxjKz95PlXMTFRNYW5B6ouy4V8tUMelLukXf5KuCBqWXWJ2YVZGHtKEbA0cJaCgdg44VIk3TqcfFBXrHwW6egROKRf48BQFp73W1j2eN5iZjfIDD5u+dzyYejfFGW53a6k/CRj3tfNwkKmYvwP5DJfgUrHbh6PTXv3j8cUSmSfL50Fi4UG2PWVQYX4Ue5Qch5CS4xMY/p6aIyLGz/qSbPJzpYBmtiodmncJJcJu/ReS6n6z4/rHePLioNab SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2022;20:b+xsoQbaUcYAhqRu5DYokgjF/YWmpQSCl8cEF5jREQ8IKHuklWILeu/8Qm3Jll1g1WzALXsjyXfbc9J2dXrAYQFPFBphNjygYMn3e+I+2ce+cXxy7d9nl82P+8Elf/7SaHTd0Tnl5rKw98rXcayD6apW2sHs24cjS/2+54ukR04= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 08:03:05.0313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b19448f-a777-4f8c-7cd4-08d5f84e60ca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2022 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.08.2018 19:22, Vladimir Davydov wrote: > On Wed, Aug 01, 2018 at 11:55:52AM -0400, Johannes Weiner wrote: >> On Tue, Jul 31, 2018 at 04:39:08PM -0700, Andrew Morton wrote: >>> On Mon, 30 Jul 2018 11:31:13 -0400 Johannes Weiner wrote: >>> >>>> Subject: [PATCH] mm: memcontrol: simplify memcg idr allocation and error >>>> unwinding >>>> >>>> The memcg ID is allocated early in the multi-step memcg creation >>>> process, which needs 2-step ID allocation and IDR publishing, as well >>>> as two separate IDR cleanup/unwind sites on error. >>>> >>>> Defer the IDR allocation until the last second during onlining to >>>> eliminate all this complexity. There is no requirement to have the ID >>>> and IDR entry earlier than that. And the root reference to the ID is >>>> put in the offline path, so this matches nicely. >>> >>> This patch isn't aware of Kirill's later "mm, memcg: assign memcg-aware >>> shrinkers bitmap to memcg", which altered mem_cgroup_css_online(): >>> >>> @@ -4356,6 +4470,11 @@ static int mem_cgroup_css_online(struct >>> { >>> struct mem_cgroup *memcg = mem_cgroup_from_css(css); >>> >>> + if (memcg_alloc_shrinker_maps(memcg)) { >>> + mem_cgroup_id_remove(memcg); >>> + return -ENOMEM; >>> + } >>> + >>> /* Online state pins memcg ID, memcg ID pins CSS */ >>> atomic_set(&memcg->id.ref, 1); >>> css_get(css); >>> >> >> Hm, that looks out of place too. The bitmaps are allocated for the >> entire lifetime of the css, not just while it's online. >> >> Any objections to the following fixup to that patch? > > That would be incorrect. Memory cgroups that haven't been put online > are invisible to for_each_mem_cgroup(), which is used for expanding > shrinker maps of all cgroups - see memcg_expand_shrinker_maps(). So if > memcg_expand_shrinker_maps() is called between css_alloc and css_online, > it will miss this cgroup and its shrinker_map won't be reallocated to > fit the new id. Allocating the shrinker map in css_online guarantees > that it won't happen. Yes, doubtless. >Looks like this code lacks a comment... Ok.