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 D30DCC4332F for ; Mon, 20 Dec 2021 08:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbhLTI7r (ORCPT ); Mon, 20 Dec 2021 03:59:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbhLTI7r (ORCPT ); Mon, 20 Dec 2021 03:59:47 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3508EC061401 for ; Mon, 20 Dec 2021 00:59:47 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id m24so7547786pls.10 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=wQH1X3d+R2d0MJpLHmLowBf5Agc/ieYPMVtX9rYZJhvkx2FsqkqHvdqzRtTqNPYlDD 63D1FpoJg0tIZoXAQJFPLfxQxxbg1xhkyDhjYHDC2xnx2G/t+Y8mEa48zv5KVdjX+mQ8 OXs+qxqPsKIKzshm9xceVCzfnXR1w0f1h6VIjlFLBRBxl3sr8cBnAp5tKRCts3PqBJPY c2dftXpscjY8r4D2Hsmoeo/gcgmiG5Cm9LzEF+F2Yh+nbz84rw3Ow58LbkEqdW5uk9mR i4yZrVmAFWEjSLpYZbYW38uaL0fyE4xFBJpd5oo9nrK1F7bx17B0mzTZr6rkseGcsFEd lQ6w== X-Gm-Message-State: AOAM532DDE8EJ6+j6gyiEJKO0NsaBeOv1/HYWSqs0tv68iBao2OQ0Mdw 8rrfvo/fFyS/mrpBFr/vYrRBhA== 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-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 | 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