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 5445AC7618D for ; Thu, 16 Mar 2023 11:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjCPLTd (ORCPT ); Thu, 16 Mar 2023 07:19:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjCPLTa (ORCPT ); Thu, 16 Mar 2023 07:19:30 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E89C4887; Thu, 16 Mar 2023 04:19:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 798A3219F2; Thu, 16 Mar 2023 11:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1678965537; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fJrTSOgLTLUlp1W52J6Jwwi7YpT3kHrlaKbevG+GqpY=; b=SYKEOnDEN/fLnIcTPgBMSbaVwGane00Ize2e5Cp6XsbJ8JOlt9QaEku5dcz4oxEPV6OkMQ FD/LMFxSJe+zUNcz1xGBwaNI4gpjLcop/WmalFoL7+8/ieopXy8QFjqw5hOzHe1ixU4hlW LfXEArZqD8FVQbieMXOGS1qOWos59r0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1678965537; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fJrTSOgLTLUlp1W52J6Jwwi7YpT3kHrlaKbevG+GqpY=; b=1d/bDz14mLHXKAFlFlVn9w2Ns6zFcQF0N1KvhwN4KKdAc6XGQLwkdolrk2wE6miJAZd9m2 w1B1+IAcVJq35BDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3B3B413A2F; Thu, 16 Mar 2023 11:18:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ppbRDCH7EmS+fgAAMHmgww (envelope-from ); Thu, 16 Mar 2023 11:18:57 +0000 Message-ID: <82c12d63-1c28-f38f-eaca-fd251706ec74@suse.cz> Date: Thu, 16 Mar 2023 12:18:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 08/10] mm/slub: Fix MAX_ORDER usage in calculate_order() Content-Language: en-US To: "Kirill A. Shutemov" , Andrew Morton , Mel Gorman , David Hildenbrand Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , Hyeonggon Yoo <42.hyeyoo@gmail.com> References: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> <20230315113133.11326-9-kirill.shutemov@linux.intel.com> From: Vlastimil Babka In-Reply-To: <20230315113133.11326-9-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/23 12:31, Kirill A. Shutemov wrote: > 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;