From patchwork Wed Mar 15 11:31:29 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: 13175680 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 8DDB3C76195 for ; Wed, 15 Mar 2023 11:32:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3669E6B008A; Wed, 15 Mar 2023 07:31:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 178746B0095; Wed, 15 Mar 2023 07:31:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C265F6B008C; Wed, 15 Mar 2023 07:31:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A25346B0093 for ; Wed, 15 Mar 2023 07:31:52 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 31009A016F for ; Wed, 15 Mar 2023 11:31:52 +0000 (UTC) X-FDA: 80570918064.12.0CBF57B Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf12.hostedemail.com (Postfix) with ESMTP id 0BD2E40022 for ; Wed, 15 Mar 2023 11:31:49 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WPBM4rQd; spf=none (imf12.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=1678879910; 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=vmR/ViM77YKelDsLGuEzhenJST8qdvYYR1/6t1wsVrg=; b=xsEAai7qSVU+5eBR156BccOjF6YIxYeTcsdfIj5HyxsFh+C5pfiJaUIvnVhCUMHjkAisFZ 6I4gYZML25JvRimq5WNuSSNvHsTWHT6NccROJwnZjxR4pPVOGA2evATXD9wK1yvA7RfVhq zRf3BzCm0y4qdANh1+tStQp/IBUdXnQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WPBM4rQd; spf=none (imf12.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=1678879910; a=rsa-sha256; cv=none; b=aPpObbbNPNJt15MAR0J9d8i1DMZyPan0IDIg7j8Fic98Mou0Z4E4DlD+Ln4Co7rTk7YNLR u/G7mdaA4sYfH8sVvhhyYLRVlEOMIONrQFVQa3a4Pl9C6xXxYd6+QR3/71H2VsD6EwfEPj YVwbOHzb7RyAv241PflSCgS+tl7MsIQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879910; x=1710415910; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KJJgxfSP5w2rtkaNO15MqwNgcC5YINyIgZH9vrQT2MQ=; b=WPBM4rQd78aqKTMkWKxsBw/KxACrxRFvp1GxDUGZCBwqeNIlbOCgnfvw 1t8TmSGrNOD936IvVNMJpf6wjnhMxQ3mHZzGBaAQacxWhs591IR/rkJbG 8NYvOVBDezKN2F4v8xw1D2ABisDXBu7483N/13lLyM7SNBuha4Y2sHR89 U+GM5/u0GRnUUJpRfo/QN3DrudD0VAEmHT0YVAeRDYKByU74PAhap0RDB 4+uhTsD9BZPgCC+1ordyakbmaSUoupL1+lBZxp/Y8bO+otjT0Sps+r0dh /wrkB0Drk220PN6Yn5jytyRefF/zdGhVT5QGCYYJ6JLSIr6RvJ836+rNK A==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040144" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040144" 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" 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" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter 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 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 6afoaz638jpzphpu71gks8xd5eeu1gkq X-Rspamd-Queue-Id: 0BD2E40022 X-HE-Tag: 1678879909-619534 X-HE-Meta: U2FsdGVkX1+hRNZtD6Owk6OArR8h0y1zZJMEG/mxpOHzgEg881ExnJz/TMul6Og4BdorydPoMZga1wIBxx8GT1+Vp6W6Aq9BcvXJ8RY7CAkwRvg0phqkMemNKrJMlUbMjQ3iuqhlPSgHq4NUGx9jUiD3YocJ1pNU++tJ5T31skqnMZMeCfeoKgUJgMTjnSYdMF+NkDenRH7xdr19gQIHVYoc19rAzNZdODuEeX+PRM/Ol6POKcS/CJwxWWOx8NaJfwT12gQWq7xeNgJGFIz93vy7QxlRRlKqTJ0l8Zp4V/TxH8QofBwAN23TG+V9BkFXVm66lZEQy0cZ7e4mTkD3QFBT8ouc5AKRjWE+JLGuDiNuBfbX7tjCvoguRDn25UlPX/nbgaVblE4gYTJJlqWuurmNu/hUIvAQ3TmDDOzW2nCpullqaVdBxpQA7nNa8NHKY//z1GC5wjjij416B9z/Y7HYYxw7ogNrJEHgxYr3RACwrSY1FnVcwaJeBzoY7QvYhtsEUUKHngu4UpcUbqSN+dQLGU4r6YFPqmnjUri199bMtwoKifsBOtJ6opEUC9+0ByG4nV9dstas5+UfFosNxAmUEJ12LeCgBBAUupLtsznsIs6lVQZS2C01YwVlQDCga5RC8kcoju7ueYY8UwS+GCMMiIY9JB5u4FWeqf9JpVER2EaFrlze+rwQog5pa8cpqTe3E2SD2uLuJI6u1rxWCeA0o4O6hIvPcFtQpQT+G/4yANx4cBXc0F4iApzHKE5cs73ZWQEaJQcsEYDjNTi1jl4Xbf0iHWGfMMizUp65CtfAT9SV7RcssN0dx8L0aA1Irfb3LWNMamd8Lvn7CzdWP5WzywngNrb0CZAPWolyRQcFf2WtExpvq58NrSo1Hnedfy3pnS/1KgN3PD5MdhGf3CpqzDUhYci6P3J9cKTSKI2KJY3q38/xUVuE34WF0pTJZf6LmWSsG1gOKXheduU tiYrKfC3 OFOQYmznojWb7oXjOoR3eRgT6yJesGIPsqG/DqCHgw6WlaQnoCGdzxD7EhEROZ4YJSIgfJoClotMKCPhnj4OtmT7ETkcT+OuOf9XDNEWza1kmYg50+dhCjJXBvcqwZKbezRy0l5B+yRCutxZcehR8J7EBrfLAqpGjofu0RJ5ebt3Ph/B5iI2N/RBdNnIm78XVl88sJWC1mqo5oUeFSP2J3fRQR0PwqZRAPpOeRmsehcPiKkFyDdkii8QSNS9TqSccVfo2z2gmdfetemHnSY8e9QX6iQXZ7f2OlPhW9I1zMx/a8NNK5Apt+9gsdJ9D5xUAlPOqfBPjOrXMW/93zI7KJ0n61itu0HKWc9ydWuHWiEly6FQJ4sXmC6FmTOS8eDHLHtAIdY5F+pCxDqZPlfLqb/31SJ8vVE2GOV+4jaeweVBkRNA= 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 rb_alloc_aux_page(). Signed-off-by: Kirill A. Shutemov Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Ian Rogers Cc: Adrian Hunter Acked-by: Vlastimil Babka --- 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);