Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1251674lfc; Wed, 1 Jun 2022 13:07:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEG8GGlbQbJ739MPrbM1+a8xrkBguJZviMPrd3Bz1JG6A6I2a7/uUQkhR1kJ1aQQCk5SRl X-Received: by 2002:a17:903:32c8:b0:166:3674:b2d4 with SMTP id i8-20020a17090332c800b001663674b2d4mr1087877plr.173.1654114034475; Wed, 01 Jun 2022 13:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654114034; cv=none; d=google.com; s=arc-20160816; b=cAF+oChSVxb96egcD4ZrzX359tqIBtOtkAVaMA/ab/tw93vPVCHYbSFmLjXxxI/bs1 LIEEjcKrsGRrR/d/3wgQ1hEaQwd+TyT8sMT24Yt6iV1hqg7slmPjvU52afZVpEnn68yZ z+vB5Pdiy1ah2W2TdrGRR4X8IV0i6kggXeG3ZEOjytiEOi2lEX4oXAkLajYxJ/1m1YKL SXXlnv9AUJ08IcZBCJddcKB/B5hVPMIjUBB3AE0UpXpNW4SYGf4dCwjIGE9mMr4D8nY7 WRiTkV3OmfjNIgy2J86BoOAdBGgFZmYazCic+CmKKAZQuXSFtYFQdFBKjEyrAEjOeMBV wcmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=TifpfMoDlGxLgqXOhSyuPYzc2dB196x72BY7fE2wUZk=; b=SEhCI+qAg2MQWJFCERBZf5BoOPK3zyg2TTskwJH1M/LYnWaScPLQ8iOQ8MKtp16VjB qnLwyD9BbIdNPShb0FXzKybbWVUu2wU4NHSP0khKe+mRNejhv1S21NjAKEkR8v0uLWiC YjMgDnXPS8Ki/WvzhcSuvYKVGbt/WkrAEWuHHG0s4qWGYvK00HIhN+MRg7Z8ArTy54IC hN/2oU6sz5lhggOzi7kIPnKISQADKZqBRMgxCeHPGjyW+tm8uYS3S7Y3JxMOQwD5fd6S RfgtkN20YiD2B5notMfrKrDGvm6JQUT94zHP5UJoLxgnY9LmgoYISgMH9xn8+IZLPL0i fkvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NX1qO31N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q7-20020a17090ab98700b001e32a639040si6977609pjr.67.2022.06.01.13.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:07:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NX1qO31N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9754110FE; Wed, 1 Jun 2022 12:22:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346490AbiEaRTh (ORCPT + 99 others); Tue, 31 May 2022 13:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231337AbiEaRTf (ORCPT ); Tue, 31 May 2022 13:19:35 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D77AF14022; Tue, 31 May 2022 10:19:33 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id gd1so6207066pjb.2; Tue, 31 May 2022 10:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TifpfMoDlGxLgqXOhSyuPYzc2dB196x72BY7fE2wUZk=; b=NX1qO31Nmah+xqNr6YcOYiJumlgg7+QsK1AYsMYODbBoAwGGqI4wTQpZGnBMJ+E9yF mzTLek8eUCaBAtCzBt0RCWIu1CNWH0oAjRLN1kZ4+UHLZI9Uj2OEHZUSnR+exDoYAwe1 0H1CEqjc+D9COgvl3QskBuO6vXXcqsLYAkQWawKc6B6G3xXMlv3jZpOLFH6JJWkBdK7/ b7chkKFHxD9s1OhJshxp5APXdWd4Jso6xosmRmVJ75DCO3s3qNoznXFYBrCvScciW03j IA9JfblnJHNiesH0Xs+VMZxl4yJxnqC6svpsDJklGI3VFA3jjtYqAHp0qFi1iTtiy0pY S27Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=TifpfMoDlGxLgqXOhSyuPYzc2dB196x72BY7fE2wUZk=; b=GriZLBzZQ0pnqy3/TN/LOBs4Oz3lftyuvITWatfca4QPFZRMvV7zv6JDg66J6+mV3K 4U1Klj8rD3nlCl+Tbkg8w8rAEWYQCAuv3LCegM5TLDpNDc9EMEjf/DEaOzwiVJN1bF0O P4ifkdVkOj6QhvB6FTWil7nomHRVeJsG4X/VyA+i2UGqCYbES53mDm/LZBQ70iIZq446 Az3KWQ7tnksWzJFz/baRH2f2pRfeEaH1Fi+K1cg2vylnBz1a2Khj4NcDeKdjQmqSwz8T hIbE6pnAZivZNItt1agbEEV1U1AuhPa76Ah0ivs8IUGoeVXDT4R4hDkzO3w9IqCxwD/l cWfA== X-Gm-Message-State: AOAM532KsIgXnfw0ct1/T363VN7PFxrN6JUghL4+9yHihANp0xQbARc3 dv2fQbdef3wjnEY5ZFpaHBbstlfbYxw= X-Received: by 2002:a17:90a:bd89:b0:1e3:50de:5ccf with SMTP id z9-20020a17090abd8900b001e350de5ccfmr1482046pjr.104.1654017573119; Tue, 31 May 2022 10:19:33 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::4:987b]) by smtp.gmail.com with ESMTPSA id y12-20020a17090a390c00b001dc37aef4ffsm2274266pjb.48.2022.05.31.10.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 10:19:32 -0700 (PDT) Sender: Tejun Heo Date: Tue, 31 May 2022 07:19:31 -1000 From: Tejun Heo To: Hongchen Zhang Cc: Zefan Li , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cgroup: wait for css offline when rmdir Message-ID: References: <1653619158-27607-1-git-send-email-zhanghongchen@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, May 31, 2022 at 11:49:53AM +0800, Hongchen Zhang wrote: > Yes, the problem would disappear when add some reasonable delay. But I think It'd be better to wait for some group of operations to complete than inserting explicit delays. > if we can increase the MEM_CGROUP_ID_MAX to INT_MAX.Thus the -ENOMEM error > would be never occured,even if the system is out of memory. Oh, you're hitting the memcg ID limit, not the css one. Memcg id is limited so that it doesn't consume as many bits in, I guess, struct page. I don't think it'd make sense to increase overall overhead to solve this rather artificial problem tho. Maybe just keep the sequence numbers for started and completed offline operations and wait for completed# to reach the started# on memcg alloc failure and retry? Note that we can get live locked, so have to remember the sequence number to wait for at the beginning. Or, even simpler, maybe it'd be enough to just do synchronize_rcu() and then wait for the offline wait once and retry. Thanks. -- tejun