From patchwork Wed Mar 15 11:31:25 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: 13175672 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 9CD98C6FD1D for ; Wed, 15 Mar 2023 11:31:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B61D6B007D; Wed, 15 Mar 2023 07:31:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 064C26B007E; Wed, 15 Mar 2023 07:31:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E22136B0080; Wed, 15 Mar 2023 07:31:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D4FBE6B007D for ; Wed, 15 Mar 2023 07:31:47 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A688DAB6A7 for ; Wed, 15 Mar 2023 11:31:47 +0000 (UTC) X-FDA: 80570917854.17.7E6185D Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf27.hostedemail.com (Postfix) with ESMTP id 6940E4001D for ; Wed, 15 Mar 2023 11:31:44 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=NodePO6B; spf=none (imf27.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.136) 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=1678879904; 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=yD3tpaPj4k5AQgW+6Vkwtj3EtMhv0S63rcLrWTfZmGk=; b=C6o76Bw0i3w5E3gpDFwxuzP0mjbzTGdI052L0/2BPKsLu9ht+fimTL8f1D+8tfaM/Qu3kH 6Gtp207T46uZ07IqsfA3aDAXiwU757HTCGuAa/xlA/2GXVlg5qjUQWgG6UKdMutAJ13BW3 0E81ROZxRF7eVRqCqVLTLn8S37IE/R8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=NodePO6B; spf=none (imf27.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.136) 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=1678879904; a=rsa-sha256; cv=none; b=8aRvQss/Y2MuoAuk0R8jpTHslIEm9Bnzp29ZVIcXohqFSsp/ux88CKt1d5kFs2RcCPwN0H 0Nha9oKb2PVFC1aVZvmerLoW1JcZ8OX4KgZHbGvgVC7GxjYLjdL3M0FAFA/z/MrVmnNOx7 zoeIirOk46kblK6dQ6VetAdkgP8Ujr8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879904; x=1710415904; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QBCZQm/SBz0B4srej1vb8GPqV7WaEgnSaSI+esoAbhU=; b=NodePO6BtKzC1eFoBqqvN07GaKpdM6cYLJi4AGTJcF7isqt6O4jknN7f iKzycf4LkPiJJQRrDKw1T2Mr5kNTmz2HAfMwUO2TEwVJ+trulUcwNOQkL fzC6MLxYtPxLiQE2BPJFYxx0XX5lj6kGL5Ui2UzM2oq7r8pGh6R05j6Pa k+7jASnofEDFn6TqfbcQBNtrGBuqBSy9yA/LC9ZOWtecIHLAQ2ueAS8Bz 74MhZT0fEOsZpMSZJexl6HQR1z+LC60thj+GmqwFcK8iBAsTvx2EKZEk3 r6QtBC4Xt3+iK0DUjkT4uf7SZIt2t1nU1DEq5KaOL7skc1FMGBQLSMoWn g==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="317330284" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="317330284" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="925310515" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="925310515" Received: from nopopovi-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.48]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:38 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id B452D10CC9E; 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" , Richard Weinberger , Anton Ivanov , Johannes Berg Subject: [PATCH 02/10] um: Fix MAX_ORDER usage in linux_main() Date: Wed, 15 Mar 2023 14:31:25 +0300 Message-Id: <20230315113133.11326-3-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-Rspamd-Server: rspam05 X-Rspamd-Que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Bb6+TW99KfOTxLw2CpRY8oockfAdCcnk58W807Xh9Ra4IpMa6v7/C1nDv80RBKt6VxXlkbh3rLatxR7Mx2pOXOOO89Ipou/ssLjIzS37vEx8QU5DcqSTfyI/8eVuHMviZCQkX7yh17gy3HR4aUOaxFmeWTA95xNmx83y78T7+mzhix8A27oeQ4wj+IbxwdFpwUyECqUT6fyBuNchsC4Nq4RWIE7hhjYUd025p4u+94MfFbCmn75MI4ZJ38UyyKZmN+Fdz1gWnPeRk0OnMompuz2N9taOchc4lD8jprZjWC+NZKNaO1LY3emgb6W2CBRqamE13 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 linux_main(). Signed-off-by: Kirill A. Shutemov Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Acked-by: Mike Rapoport (IBM) Acked-by: Vlastimil Babka --- arch/um/kernel/um_arch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 8dcda617b8bf..5e5a9c8e0e5d 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -368,10 +368,10 @@ int __init linux_main(int argc, char **argv) max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC; /* - * Zones have to begin on a 1 << MAX_ORDER page boundary, + * Zones have to begin on a 1 << MAX_ORDER-1 page boundary, * so this makes sure that's true for highmem */ - max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER)) - 1); + max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER - 1)) - 1); if (physmem_size + iomem_size > max_physmem) { highmem = physmem_size + iomem_size - max_physmem; physmem_size -= highmem;