Message ID | 20230315113133.11326-7-kirill.shutemov@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2274093wrd; Wed, 15 Mar 2023 04:35:37 -0700 (PDT) X-Google-Smtp-Source: AK7set9ozP1r+aV29KPzvo+4kTNtd1gWO4UWqD0UqbmcD1rNw9yQXG3P4CsfPLcyzYCxes86aDDu X-Received: by 2002:a05:6870:32ce:b0:177:8755:29f6 with SMTP id r14-20020a05687032ce00b00177875529f6mr11895692oac.57.1678880136910; Wed, 15 Mar 2023 04:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678880136; cv=none; d=google.com; s=arc-20160816; b=WkyyHv4v8Ikv5P94wdV7PrrXxS230g7WrPsgG1w/W0xCui5iVLjCnAQy/PG5ocLlSa ZINhEuIaa3S87L4BkOkyvbjLWNvegsgiAlMH82soJEp1HcTTKevd8v+sNtUjA0NeIgZN OmrVMWPguWirZixnRvLZVfRwxOtjp0doWT+kRzkHRfFOcwo8dN9KujgNP/qYxO8YpRzR 3oaJkM4MIgOsWRgbXAJW9UB1N50b7rZVI3pMIBsZ93BJUl3PfbHjtqEAXtb5bI+LFuHu RMT3kdaoFUxS3CmAUdu502cASrG8SdIxrQm1L9ua7f4Z3W+4eR1cHvqE26TftN+/gr6z Gokw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vmR/ViM77YKelDsLGuEzhenJST8qdvYYR1/6t1wsVrg=; b=gF/h2Nm0K91UF110UcGJfjByU/0PG1Rqb+pNjTtIY2FaZycjP1yRucaGXd41HqmtAX kv+iRYZe1YcNE0Urp5gRWh8iX+/tFC25JhEORpWUJBM/x5r36j14oj3DszTUBikuqJ4z v/c9OyJWBHkUETrvzSl9gSs0ZRCv9R8YF/IsvW/JA/n64ng4iTS2yknOrDVC4EL0IMpd XVkIKoBzHrbjkMOrxjnxqtkBhhPFdrZG96aKDfE+a6dYhRcjm08+Wk3X2g2bpvfixGSG NuZclE9bfkZrJRTyD55uUd1uNJ8OwKamXWjygHDJzR3smPS1FWcsXQ687r+UlzHtIguF WGtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFIJz5RT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l46-20020a056830336e00b006884f468b26si4504755ott.257.2023.03.15.04.35.23; Wed, 15 Mar 2023 04:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFIJz5RT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbjCOLcO (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Wed, 15 Mar 2023 07:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbjCOLb5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Mar 2023 07:31:57 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D178664D0; Wed, 15 Mar 2023 04:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879907; x=1710415907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KJJgxfSP5w2rtkaNO15MqwNgcC5YINyIgZH9vrQT2MQ=; b=OFIJz5RTr0KulGvPwLtNejHHmww9sohvdM9pYVkC+2Zg1frCCbt/qopb HC+JiS20rn63B+HquZdtaYJQLzFSMzbJOE4T1BNoae9nXWKCRz1RFhNDy WDvy9cx47XCM/jmW1sPpN3+4aq0c3Sy+RVRj9d5wv0uDWhmd7xthuaJWy TPlUmyprae0mLDXbG+p9jzPR4ZEuR6bhuGYYYjs6mD4KNh108vOpdM1Qr msiAPTzAHx3hrBCMP/bXWktuTLV5xWMJIprNRxSvbxRscOJIVyQDLkFEM zHHzEViP1kLLBW4m1EM2xDICjC1K+9WAvKhP//mswx/vq5ZfujXRrJkEU w==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040142" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040142" 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:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="768456024" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="768456024" 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 D288A10CCA2; Wed, 15 Mar 2023 14:31:35 +0300 (+03) From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> To: Andrew Morton <akpm@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>, David Hildenbrand <david@redhat.com> Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com> Subject: [PATCH 06/10] perf/core: Fix MAX_ORDER usage in rb_alloc_aux_page() Date: Wed, 15 Mar 2023 14:31:29 +0300 Message-Id: <20230315113133.11326-7-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760433418711568518?= X-GMAIL-MSGID: =?utf-8?q?1760433418711568518?= |
Series |
Fix confusion around MAX_ORDER
|
|
Commit Message
Kirill A. Shutemov
March 15, 2023, 11:31 a.m. UTC
MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
can deliver is MAX_ORDER-1.
Fix MAX_ORDER usage in rb_alloc_aux_page().
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
---
kernel/events/ring_buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
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 rb_alloc_aux_page(). > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> > Cc: Jiri Olsa <jolsa@kernel.org> > Cc: Namhyung Kim <namhyung@kernel.org> > Cc: Ian Rogers <irogers@google.com> > Cc: Adrian Hunter <adrian.hunter@intel.com> > --- > kernel/events/ring_buffer.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > index 273a0fe7910a..d6bbdb7830b2 100644 > --- a/kernel/events/ring_buffer.c > +++ b/kernel/events/ring_buffer.c > @@ -609,8 +609,8 @@ static struct page *rb_alloc_aux_page(int node, int order) > { > struct page *page; > > - if (order > MAX_ORDER) > - order = MAX_ORDER; > + if (order >= MAX_ORDER) > + order = MAX_ORDER - 1; > > do { > page = alloc_pages_node(node, PERF_AUX_GFP, order);
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 273a0fe7910a..d6bbdb7830b2 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -609,8 +609,8 @@ static struct page *rb_alloc_aux_page(int node, int order) { struct page *page; - if (order > MAX_ORDER) - order = MAX_ORDER; + if (order >= MAX_ORDER) + order = MAX_ORDER - 1; do { page = alloc_pages_node(node, PERF_AUX_GFP, order);