From patchwork Wed Mar 15 11:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 13175678 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8876FC6FD1D for ; Wed, 15 Mar 2023 11:31:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68D326B0089; Wed, 15 Mar 2023 07:31:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E5FE6B008C; Wed, 15 Mar 2023 07:31:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 178C16B0087; Wed, 15 Mar 2023 07:31:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D22446B0087 for ; Wed, 15 Mar 2023 07:31:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A24891A07CA for ; Wed, 15 Mar 2023 11:31:51 +0000 (UTC) X-FDA: 80570918022.21.51B6D96 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf06.hostedemail.com (Postfix) with ESMTP id 70C4C180011 for ; Wed, 15 Mar 2023 11:31:48 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WtQzookd; spf=none (imf06.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678879908; a=rsa-sha256; cv=none; b=YJr9hkOTPEJwvWVuJfFLXYulshPDY55i+ZdDlxv5l0jzn9AjQWPfkYaxSa4cJ+PLaaczyU RPCPdzkXObLSeyqzGoBa6exmBJpYV0Uu0lYNKVq8Wvw4ijhYToqtziofpKynX2BgaBs1xB qOHr8V9cOceFcfa9ORIp4iyypSWQcSM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WtQzookd; spf=none (imf06.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678879908; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AT1GhwbDyWrvyJUMDRYHSLUugvLdHkN1MSYo/oKLUQE=; b=5f+NY7NVZBeW6tu3dZmg1c/y62XFAPDrsc3hu8i7YTRfCD9XAvvciLdKuMfWXKzOEehJ1P xfSE8/IcLoxxLdaMs4/FVbGi/JprvfBVC/wzbFYqXxaIlW4MUI04KxpMgMYrUqW+czIKRm +2YNWqQIGDEUG6Z5o0576KLAY+0hCRs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879908; x=1710415908; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=52iLXUh9Y9J9QoTpEvXDHrqTMiCmRpr/0OkWw2Dmeo4=; b=WtQzookd1IEGf1lqi54J7AJ/1a38sKgTXQr8lFAvs+IAAxXRE+1SE7ra AhtzGpVX/HWgbLjVrhvWHuh61LT6g/SYnGykACvmr9E1/DGAwVigj82uf rCoAMY11eZCrNYzDPrw1h+EPsCkLEfre3Te2KDUsgvXqx51or+HOrHH+r Fr+L58WidnOEKi+y3T+mTwvbjZJPLrFyTL6NU/859aytUZjDdaP5734gL FQVDO6nwkHtYctiiCJvjzCQCCQ60wOmZMKSrnA2VN5WoLaz0+YBAxZvch yiWjzii9sjW/uIyeC0QOqrIYJXyUVt7JgwHgc2hxirPntI4rpYUV5D6/1 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040127" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040127" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="768456012" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="768456012" Received: from nopopovi-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.48]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:43 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id E47DB10D684; Wed, 15 Mar 2023 14:31:35 +0300 (+03) From: "Kirill A. Shutemov" To: Andrew Morton , Mel Gorman , Vlastimil Babka , David Hildenbrand Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Christoph Lameter , Pekka Enberg Subject: [PATCH 08/10] mm/slub: Fix MAX_ORDER usage in calculate_order() Date: Wed, 15 Mar 2023 14:31:31 +0300 Message-Id: <20230315113133.11326-9-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> References: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 70C4C180011 X-Rspamd-Server: rspam01 X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bD88fIsXrAUM7oV8LV30GDaHdJsk7jVp1vSl/333/RBtx1bImqbHP8fawORfvfK84V17G4SVL/2jyoBI+g4blFpqEtMK1Ch9lCqegyklc8beftQ2u4LUFMiDGr8KkDtg5WIruesuwiVgfcZ80du1c58Hgu/BMPOsYCsvOV04wcoxNTmPhKXmY3gDe/OYJR7Ng80lOE4KKTJN7IWpMlYEPn6xarvg1HPAxgBNCX5c4tZkzn6GVPoa7PEJKl9WdXs7JNw8nwRsLk5CypWIFTmgMEk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in calculate_order(). Signed-off-by: Kirill A. Shutemov Cc: Vlastimil Babka Cc: Christoph Lameter Cc: Pekka Enberg Reviewed-by: Vlastimil Babka --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 39327e98fce3..32eb6b50fe18 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4171,7 +4171,7 @@ static inline int calculate_order(unsigned int size) /* * Doh this slab cannot be placed using slub_max_order. */ - order = calc_slab_order(size, 1, MAX_ORDER, 1); + order = calc_slab_order(size, 1, MAX_ORDER - 1, 1); if (order < MAX_ORDER) return order; return -ENOSYS;