From patchwork Thu Apr 25 07:19:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13642911 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 B8773C4345F for ; Thu, 25 Apr 2024 07:20:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82EF56B009D; Thu, 25 Apr 2024 03:20:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78B976B009E; Thu, 25 Apr 2024 03:20:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E00C6B009F; Thu, 25 Apr 2024 03:20:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 36CFA6B009D for ; Thu, 25 Apr 2024 03:20:10 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E5EE9C0467 for ; Thu, 25 Apr 2024 07:20:09 +0000 (UTC) X-FDA: 82047205338.03.B9D3E2E Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf12.hostedemail.com (Postfix) with ESMTP id 54C5C40014 for ; Thu, 25 Apr 2024 07:20:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ky8NsCls; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714029608; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=4L+NbA3Hq/qfgSIUOMT9TI5a3SJ6I+DGvOxbUdHgPRY=; b=OG50tQpWEiEfZHG4CYkCQrPuNMfvf+g3oX77OAa8gCH7OzGF0G6JeEj/0nTFEkv+vQ7e1Q VE7nCOCXHf9ub0mACnQLrjmgtcZUF4b8IEMsMmf5DE+JIML7n+QxGkTLw/TgSJ1ARduv1a r1PH7kZEz4KxqE1dpzTVIdlt/sDjg2k= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ky8NsCls; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714029608; a=rsa-sha256; cv=none; b=OdTe5McgwcG+2UyIPxaAlmQ5TPo1yShs+/d5PjI0k2wTOh4aHHh9iqXJCYqMuwIBGIXC87 wQCOUgT2QF0ILxQ+1vAv796TR+CMP7FGVnEhQf5GtskgGmasFdQtmpoAdoY7/M36DozyCC WPlQel6jzVvOEnri+gdPLbHGk7fRUvQ= Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a55b3d57277so74235566b.2 for ; Thu, 25 Apr 2024 00:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714029607; x=1714634407; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=4L+NbA3Hq/qfgSIUOMT9TI5a3SJ6I+DGvOxbUdHgPRY=; b=ky8NsClsXHpkK84PQnu5JvRZh+B+6sCIVd+IR/LZPBhfAIAHx4R8y3GFIFgzxGQvTK 7KiqXXiDoreV1ZNPIDUR6eWy2+hMuAh5iqsV1WE/dQJJy6ZPOEKnO36aix0zpHfG+Ibs PG6uiyA7OD61ziidb96Z38Kq8SUZ1NI3pZLBu0H59VFPNA3z43W+YgIqS8FW95BFse1n ii3xNXoLq8SfE5oQSeqWd7aCFxW2V6S540nHLeUT+hZPVsMkOx+bkH1E9Ud9I6fGdEuV iILX6AuTXsbBy2yRDn5SKn/dFxhfGJ150Ae682dyHNz9sPJhpgSVk2YkNHKdHfLu+sfy j2yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714029607; x=1714634407; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4L+NbA3Hq/qfgSIUOMT9TI5a3SJ6I+DGvOxbUdHgPRY=; b=iSB/A1mJ2lnCOh7CGN7T0TzXyKuiDSCwaRvMhIrZekef6NKUvRh/0CKfxTVHJxoshV I64Z4pH1+p/lhbMZreQtizoqKVfCguuGEDWxS+jFi6CsHMdusbxeWR7PDc3GbKzVWRUT VWuBNBHpxzr8pjrGGvuhOVdZfY+akSdQMMgfkj+ehLp64sAkWX5BFpAln9xu9/lG5yQo 2/2xfxeIKxQPHKoMToXBfuciUXRUoARHuBF4xkSPi6JnTIfvD48pDefWlMzKRvarBBUE GrNJw5+XIzXtDCYJqhfYJfQCT1STn0nHWoH2gN6h92fCJ5oFcoONwKjYBF0Q1/V/7X7H aNlw== X-Gm-Message-State: AOJu0YwHTk1wlSWFpzpzyFvX0uEzWCLBzQMyJlK4NrgG+SlF0VeBYAqf XpIbmjsX+ZW8IvMMkNU3U6OsrR5eUMrRRUR0aNERc1XQ+2L+xqV4OxRsf6R9 X-Google-Smtp-Source: AGHT+IFwxB0MCZU2v2XiwXwvIJE9Ao2ip8Y+9MasoIh+AqJLs3iWYKys5vZZ3DGDuTgMbCmz4Nmugw== X-Received: by 2002:a17:906:a38d:b0:a58:7298:fd9c with SMTP id k13-20020a170906a38d00b00a587298fd9cmr2886751ejz.22.1714029606995; Thu, 25 Apr 2024 00:20:06 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id bv9-20020a170906b1c900b00a51c5940247sm9140894ejb.213.2024.04.25.00.20.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2024 00:20:05 -0700 (PDT) From: Wei Yang To: rppt@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [Patch v2 7/8] mm/memblock: use PAGE_ALIGN_DOWN to get pgend in free_memmap Date: Thu, 25 Apr 2024 07:19:28 +0000 Message-Id: <20240425071929.18004-8-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240425071929.18004-1-richard.weiyang@gmail.com> References: <20240425071929.18004-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 54C5C40014 X-Stat-Signature: d98tsf8d39z4m6agh7ozoojyxnm6exrx X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1714029608-587148 X-HE-Meta: U2FsdGVkX1+SZaAWhTF6kdeIj5Ha9pAERGBM/jmBbpGsCvXqQHayf5WiohBUppi4mJ6otbp7tAV1gpK8tR9UryPnXuFZX9q3INSunAtUwmZ33ZQAmOjqZ/5RNhJ2cmPxLxzoRIUGH47G8j107Zeq0i88UjLvlxCkIaUNtPdad0cU6Hy7RRQcZ0gqjzEgnl54vtyM3moNy2j5uRxVo/ov9T04hxJb7tEDeJbFGs580Dk63BADSI00cgm0KSYLOu2H4J7Bh1mti8/g0cfzMDbCZeJ0ExX9A6NlhBSNMj1jVyhHkS2xZMswY03vyS3p3xeWsd9KzqmwPTGf+/AQd5oCXEPn7FJXDDuNZeL5+yxFFHmNSQXgo2u4HyRybORRaAvSQJRdpEdUKm3AxvtarWW7GbFnkcBUzrHsMDEFBuddoIoEyw7Y8+a+aJhrEdFYT09pWxqkLUuif8iEEuM9v74Hm4DkJ44d/hN0gy6uX0OVQnWpjhDsrQ1KxraafyV3spLr0UTNvjO0EHLvtomUiEZclWZFRr0Z4oPWA6mqMhzV4a/GwvMZR94jOdMO+tM77Ac1Yo4ueJ7SU5KM8FBHOhWr/czgBremsle915hf+5uT6vUa8V42lfuIPxgFAfEE3udVt1HG35JP/2t4vw6gsIcF8kMg+v2Mz9+COvSiaDeHoufIUlijgelJoggL1KJgeEj97f/tDzSravPBFCoofcrZlYM9PmrGuF5D70/eyHuNgxr7hSqHr+docQoqU/0JIx4L0PBs9W+tk+qRmW2VWK7ifEDqBkeSQxMucS2m+nrXHfkhQw7PliTppBrzArLoHndTAUZ5rRU/iZ1pjOjPw0LrtnpcMCN39W6IF/R4llA5uUiCUQzPeUQyv9gDnZU92cYj4aETIZm6ZfpQRKi9b0UqQWXqbF28YQThfRdClaZbU0tBsjPFNFz4jQIwQrjJcxP9NNHiWnJXYRrmEj5+BDm LMjw7wZy vyA+pUtTALIUkyV5fteAp/9XtW5ceJ3eD8gEmJkrXxdQvajydVwOECvbcJh1f1EM6i115yvoyrxstw71kI/hgDPd8nviINM+fCxJ9q3n4Oky5Efp61lF2OnTmtXITklxffFVQHDPevEnBtIOdRDf9zkssEWtQrqQwoTuYY1agb+S11W08LuiElDmtEYgh1bHVRg3xKxx7mwLsZSVGNGM2W9spw0OkSE2DEKQW X-Bogosity: Ham, tests=bogofilter, spamicity=0.000409, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Leverage the macro PAGE_ALIGN_DOWN to get pgend. Signed-off-by: Wei Yang --- mm/memblock.c | 2 +- tools/include/linux/mm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 4125506d8af9..9b4fa8fea9a2 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2046,7 +2046,7 @@ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn) * downwards. */ pg = PAGE_ALIGN(__pa(start_pg)); - pgend = __pa(end_pg) & PAGE_MASK; + pgend = PAGE_ALIGN_DOWN(__pa(end_pg)); /* * If there are free pages between these, free the section of the diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h index 7d73da098047..caf68f5084b3 100644 --- a/tools/include/linux/mm.h +++ b/tools/include/linux/mm.h @@ -15,6 +15,7 @@ #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) +#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE) #define __va(x) ((void *)((unsigned long)(x))) #define __pa(x) ((unsigned long)(x))