Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2706378pxm; Mon, 28 Feb 2022 04:46:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI0PRjz8aPQIv+2+A+9/lcDqPcNiWXUr3O7VLk0jcbFxlw1M9NpHk52qP2nHphAiL81zay X-Received: by 2002:a17:906:8299:b0:6cf:3847:284b with SMTP id h25-20020a170906829900b006cf3847284bmr14982292ejx.682.1646052397703; Mon, 28 Feb 2022 04:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646052397; cv=none; d=google.com; s=arc-20160816; b=ilPxXjubkSX7d1lfxv+f9bMGWFIPHb0xirFI/3YdtdSU4nEy8n4l7hJ9bNTJlIu/9g q7WAvs0KPbNgSEqB0xMIQyk7hBDZpyFij+z+1aD0mLMYPWGuPoLbFZ5+av7TKbPLmdpu Q72VvEme3xTgjvqPdmpZqRZC//fvtCfMpB6gUfTznH+q5XCUX/CvhMjCKGpxXPsTeW/P SQl0KnpHNG32j9Maj23ghuCA3Wfbyxx+gdTObYcv5n1kLrjtMaCzUWYN1JZcqTto+47+ GcY5MFUw7wJ7kADAeHyQ4eP/txIE5B9H2jASCM4Bswj6bPGSS5hmiB4Rz8FOUAZAgBax omLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OoMgzdYapj8GOdfPEOkybEme/3XTyQ2VrTMps0q2PrA=; b=Kx0fyfyEz1GG9lB23rOjVpbBxFKM5PKw8wimi07BLTDw5prQQ3naJJ1KxMk9CyRDd9 VD0vH68sQ3Fy55Nlo+7CAqXzEnfbZjOZw7uHtIYZ3HNgO86SbC4Q+HGSuftu8tHaHTSf vpaMGnzTD6lC1PWk7K0AmySa3RjptDE4yq42ypgV28tUuzYJgqc6xq/dAyP4buJpiFhS hPJz4+8ErgrSevYgEKYvnoyEr1zgJM2GTB/eQTcepYx3XwN/tlH8SIPXy2hWm/vQZBWk of3uUUg7pfyJxZ/L1tRiKrF3g5o+IbK3l4OXYDp6PrCK+KqH/qYLS59xQQtVYEs2JJAD TSxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=MY4WDJ8X; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a0564020f0b00b00410a8bd95f8si7393812eda.99.2022.02.28.04.46.12; Mon, 28 Feb 2022 04:46:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=MY4WDJ8X; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236401AbiB1MZi (ORCPT + 99 others); Mon, 28 Feb 2022 07:25:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236505AbiB1MZQ (ORCPT ); Mon, 28 Feb 2022 07:25:16 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B10E975E5F for ; Mon, 28 Feb 2022 04:24:17 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id h17so4993566plc.5 for ; Mon, 28 Feb 2022 04:24:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OoMgzdYapj8GOdfPEOkybEme/3XTyQ2VrTMps0q2PrA=; b=MY4WDJ8X56A+gQ/cLVJur3SrDm3EQKN4EZJt5lZ+9Cjo6Qf9bggHRbRFFzT61hhveJ 6llCa/oKNMcsL76YUQw6b2d6O43L82wgPEiEHoU+ucBYNIVlHE3DWygEJoZi6YSvWJ67 /wPNjrpz1ZMRw0ww9cakaygssVdi8m5NyOgvH0cttq0NVGVWMiO+8SW6Ce6TYCW9DpUz CCfNEsXaEm1bwlznl+crzJ8BZNp/0S/lJuMXy53yMDCRRI/6DVnvCVD+8L9n8BQ/0FsJ 0V/AkT/2mppxZSGo9WhzogNTJG6buGPwCZ8xc4qX9CCzzQd2534lOpSgMCU3uGRGYOUO NpaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OoMgzdYapj8GOdfPEOkybEme/3XTyQ2VrTMps0q2PrA=; b=bHdZ265wOh66R1FLo1SmUmderylUNdxbaSrU7lzBpOGi3+8s0I0oxXgC8B2lw69KQZ H05JCU3rZPYEFWlog7xws3NLYc+OzP75vdd1YJpCOVoT6S/z/1BKt1drVI/DRB6Hw5jm jk1g+X5eNwIBtdz+PoIxZuTOXqCQiKzAfhffGzi026N/b91laxnA77Wd2ZEGxXQmqekY 9JAVAYcgadd77jdRb8xAPBB2+fqF8ao3FY/zTRHSn1sbnV81Tk7U2Y6rAnMQdZQzUa4R syfjtXApCzMI2z1KEkZVEgGAORrXOwFiFhlcHLt8RolGJ/tn/sDcN/5zZl8yTgWZZqUn hVlw== X-Gm-Message-State: AOAM532g7mV/paU3XwcQCou1ODKbR0MKKpGUxFSLE9vUmAFFSl+RuLt6 VGnx2jeRBVg/wftkRwkuGqFnLA== X-Received: by 2002:a17:90a:d511:b0:1bc:50c9:8d8a with SMTP id t17-20020a17090ad51100b001bc50c98d8amr16432585pju.112.1646051057271; Mon, 28 Feb 2022 04:24:17 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id ep22-20020a17090ae65600b001b92477db10sm10466753pjb.29.2022.02.28.04.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 04:24:17 -0800 (PST) From: Muchun Song To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, roman.gushchin@linux.dev, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, jaegeuk@kernel.org, chao@kernel.org, kari.argillander@gmail.com, vbabka@suse.cz Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v6 14/16] mm: memcontrol: fix cannot alloc the maximum memcg ID Date: Mon, 28 Feb 2022 20:21:24 +0800 Message-Id: <20220228122126.37293-15-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228122126.37293-1-songmuchun@bytedance.com> References: <20220228122126.37293-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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-nfs@vger.kernel.org The idr_alloc() does not include @max ID. So in the current implementation, the maximum memcg ID is 65534 instead of 65535. It seems a bug. So fix this. Signed-off-by: Muchun Song --- mm/memcontrol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 809dfa4b2abc..cbe6f9bb37bb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5029,8 +5029,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) return ERR_PTR(error); memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL, - 1, MEM_CGROUP_ID_MAX, - GFP_KERNEL); + 1, MEM_CGROUP_ID_MAX + 1, GFP_KERNEL); if (memcg->id.id < 0) { error = memcg->id.id; goto fail; -- 2.11.0