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 C2740C6FD1D for ; Wed, 15 Mar 2023 11:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231807AbjCOLcH (ORCPT ); Wed, 15 Mar 2023 07:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbjCOLbr (ORCPT ); Wed, 15 Mar 2023 07:31:47 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5B965C47; Wed, 15 Mar 2023 04:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879906; x=1710415906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=52iLXUh9Y9J9QoTpEvXDHrqTMiCmRpr/0OkWw2Dmeo4=; b=n4qGSVd1KWwKf79MuJ+BWAiNhFJ/0cplH9BwCSUBi1SiKIl6/qJKh7K/ hUa+QY8L59Ugses5W+Wptllm24q0s8aiRZQ8US7skxhUrMFYitRhicw2k Gfq8U515nc+uCXnbTPkDrizOUgFdLzLYWAV/RZoNJD4plkHZ/ROCh3215 zcI39ZhPFwpsUP43lXMpizls8xdI0fzlleAgI8w5Ce5Z7yCHEfMvSZinF XCg6hUopBxNA4KVDUTw4v8KOTBPysR40ePTrR92bj6Y1TUEePfU6/OrgD k2fF4B9P+qucZjk+UIkHywzdQPRcw+8TP9tx5jR4Me2C7cO5CTn+6cLyn Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040125" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040125" 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.39.2