Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B359C43217 for ; Mon, 20 Dec 2021 08:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238211AbhLTI7s (ORCPT ); Mon, 20 Dec 2021 03:59:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbhLTI7r (ORCPT ); Mon, 20 Dec 2021 03:59:47 -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 2F90DC06173E for ; Mon, 20 Dec 2021 00:59:47 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id v19so7554667plo.7 for ; Mon, 20 Dec 2021 00:59:47 -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=kLFOwVFiZIjw3RVJm6qr/zBDVNSCqLZEWF5PJy3+HZY=; b=1m1uipmyXDVKXnb/j83XSckTtYI/vWJY+8BsxopX4OSiNiDP+urm0WN/C/haMxrDI+ 0MnF3qDqBtBh1Rscr+qsKFHU4osXfIYZUo/iPFn1THWNtnyyIHZdG87Fa3p6jy+pxK8h 4UtpPN5vnDvJysuRkEfB7mf+LkGkxjzifGGjiKkkPPd5nBHVveADhXUSzP/z+lqRVYE/ obkCs6GuNpTLTy+G81CMMg9Q5BNV/HakZKn8w/JLJaHt13hDOGu4FF4H6Z4M7bUGY0SI 8F1orSxIT5IAhepsD91tdQpVP0m+eeAlhuPovFXskKkyHPXNA5W4ZFwZkYmDbhO4QNVE LC8g== 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=kLFOwVFiZIjw3RVJm6qr/zBDVNSCqLZEWF5PJy3+HZY=; b=WwdjTLydGchTTI7fRmbJDvLIoEE3kzd8kP/nxujQhGxD+BLdZGuOfn97i6EfbNh9C7 OUW9NVuIdJXW9Ed/g1Nl9mdVK0Zi9qNjht44EuYDD9lzV/gchD66GMXdZE2N5qjLR04J BiT5x3H/ljbGWJ5AeiHBbYglYKDwfiJO7Tm7a+h1HJGRazM0Oy1Vm4Npp+wuCZy8rgqz 1k0R8hRqrnbQS+6tmj0jgzggILnjStku6QVZCL2P2/9SRNScu3m/HhkHKB1hoirnVTMW kwoJNG8Ft6IJbEJfBhQlYqI4vNkJ+XQDN6xbONxgWNszmqu1sd65espHFjkoozKMhLpQ sOAg== X-Gm-Message-State: AOAM533E0aha0ocVUCjv86GyXrhn4a2YQ+h+tE+oNWdkx99ccPRhrq/B o14pJdOhgvv+0BmYAiDFegWp4g== X-Google-Smtp-Source: ABdhPJw5ehYc9OocA6HcKwZyTrKBWh/AB+57172S/Xshm39KLQ+cdNqTHwRjWsexAMIpf2bGpEy3hA== X-Received: by 2002:a17:902:8645:b0:142:8c0d:3f4a with SMTP id y5-20020a170902864500b001428c0d3f4amr16069379plt.3.1639990786755; Mon, 20 Dec 2021 00:59:46 -0800 (PST) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id m11sm18441647pfk.27.2021.12.20.00.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 00:59:46 -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, guro@fb.com, 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 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 v5 14/16] mm: memcontrol: fix cannot alloc the maximum memcg ID Date: Mon, 20 Dec 2021 16:56:47 +0800 Message-Id: <20211220085649.8196-15-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20211220085649.8196-1-songmuchun@bytedance.com> References: <20211220085649.8196-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 04f75055f518..fdd0007554a0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5013,7 +5013,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) return ERR_PTR(error); memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL, - MEM_CGROUP_ID_MIN, MEM_CGROUP_ID_MAX, + MEM_CGROUP_ID_MIN, MEM_CGROUP_ID_MAX + 1, GFP_KERNEL); if (memcg->id.id < 0) { error = memcg->id.id; -- 2.11.0