From: Andrew Morton <akpm@linux-foundation.org>
To: Becky Bruce <beckyb@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
david@gibson.dropbear.id.au
Subject: Re: [PATCH 2/5] hugetlb: add phys addr to struct huge_bootmem_page
Date: Thu, 21 Jul 2011 15:44:27 -0700 [thread overview]
Message-ID: <20110721154427.53e8fd5b.akpm@linux-foundation.org> (raw)
In-Reply-To: <13092910103675-git-send-email-beckyb@kernel.crashing.org>
On Tue, 28 Jun 2011 14:54:45 -0500
Becky Bruce <beckyb@kernel.crashing.org> wrote:
> From: Becky Bruce <beckyb@kernel.crashing.org>
>
> This is needed on HIGHMEM systems - we don't always have a virtual
> address so store the physical address and map it in as needed.
>
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> include/linux/hugetlb.h | 3 +++
> mm/hugetlb.c | 8 +++++++-
> 2 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 59225ef..19644e0 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -231,6 +231,9 @@ struct hstate {
> struct huge_bootmem_page {
> struct list_head list;
> struct hstate *hstate;
> +#ifdef CONFIG_HIGHMEM
> + phys_addr_t phys;
> +#endif
> };
>
> struct page *alloc_huge_page_node(struct hstate *h, int nid);
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 6402458..2db81ea 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1105,8 +1105,14 @@ static void __init gather_bootmem_prealloc(void)
> struct huge_bootmem_page *m;
>
> list_for_each_entry(m, &huge_boot_pages, list) {
> - struct page *page = virt_to_page(m);
> struct hstate *h = m->hstate;
> +#ifdef CONFIG_HIGHMEM
> + struct page *page = pfn_to_page(m->phys >> PAGE_SHIFT);
> + free_bootmem_late((unsigned long)m,
> + sizeof(struct huge_bootmem_page));
> +#else
> + struct page *page = virt_to_page(m);
> +#endif
> __ClearPageReserved(page);
> WARN_ON(page_count(page) != 1);
> prep_compound_huge_page(page, h->order);
nit: wrapping both definitions and statements in an ifdef like this is
a bit nasty from a readability and maintainability point of view - it's
inviting people to later make changes which fail to compile when the
config option is flipped.
This is better:
--- a/mm/hugetlb.c~hugetlb-add-phys-addr-to-struct-huge_bootmem_page-fix
+++ a/mm/hugetlb.c
@@ -1106,12 +1106,14 @@ static void __init gather_bootmem_preall
list_for_each_entry(m, &huge_boot_pages, list) {
struct hstate *h = m->hstate;
+ struct page *page;
+
#ifdef CONFIG_HIGHMEM
- struct page *page = pfn_to_page(m->phys >> PAGE_SHIFT);
+ page = pfn_to_page(m->phys >> PAGE_SHIFT);
free_bootmem_late((unsigned long)m,
sizeof(struct huge_bootmem_page));
#else
- struct page *page = virt_to_page(m);
+ page = virt_to_page(m);
#endif
__ClearPageReserved(page);
WARN_ON(page_count(page) != 1);
_
next prev parent reply other threads:[~2011-07-21 22:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-28 19:54 [PATCH 0/5] Hugetlb for 32-bit FSL PowerPC BookE Becky Bruce
2011-06-28 19:54 ` [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit Becky Bruce
2011-06-28 19:54 ` [PATCH 2/5] hugetlb: add phys addr to struct huge_bootmem_page Becky Bruce
2011-06-28 19:54 ` [PATCH 3/5] powerpc: mem_init should call memblock_is_reserved with phys_addr_t Becky Bruce
2011-06-28 19:54 ` [PATCH 4/5] powerpc: Create next_tlbcam_idx percpu variable for FSL_BOOKE Becky Bruce
2011-06-28 19:54 ` [PATCH 5/5] powerpc: Hugetlb for BookE Becky Bruce
2011-07-08 4:13 ` [PATCH 4/5] powerpc: Create next_tlbcam_idx percpu variable for FSL_BOOKE Kumar Gala
2011-06-28 21:39 ` [PATCH 2/5] hugetlb: add phys addr to struct huge_bootmem_page Benjamin Herrenschmidt
2011-06-30 18:50 ` Becky Bruce
2011-07-24 16:48 ` Tabi Timur-B04825
2011-07-21 22:44 ` Andrew Morton [this message]
2011-07-22 21:08 ` Becky Bruce
2011-07-19 4:43 ` [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110721154427.53e8fd5b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=beckyb@kernel.crashing.org \
--cc=david@gibson.dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).