From: Andrew Morton <akpm@osdl.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, clameter@engr.sgi.com, apw@shadowen.org
Subject: Re: [RFC] [PATCH] virtual memmap on sparsemem v3 [1/4] map and unmap
Date: Fri, 8 Dec 2006 16:28:19 -0800 [thread overview]
Message-ID: <20061208162819.f809d703.akpm@osdl.org> (raw)
In-Reply-To: <20061208160142.d40cf636.kamezawa.hiroyu@jp.fujitsu.com>
On Fri, 8 Dec 2006 16:01:42 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> When we want to map pages into the kernel space by vmalloc()'s routine,
> we always need 'struct page' to do that.
>
> There are cases where there is no page struct to use (bootstrap, etc..).
> This function is designed to help map any memory to anywhere, anytime.
>
> Users should manage their virtual/physical space by themselves.
> Because it's complex and danger to manage virtual address space by
> each function's own code, it's better to use fixed address.
>
> Note: My first purpose is supporting virtual mem_map both at boot/hotplug
> sharing the same logic.
>
A little thing:
> + if (ops->k_pte_alloc) {
> + ret = ops->k_pte_alloc(pmd, addr, data);
> + if (ret)
> + return ret;
> + } else {
> + pte = pte_alloc_kernel(pmd, addr);
> + if (!pte)
> + return -ENOMEM;
> + }
> + if (ops->k_pmd_alloc) {
> + ret = ops->k_pmd_alloc(pud, addr, data);
> + if (ret)
> + return ret;
> + } else {
> + pmd = pmd_alloc(&init_mm, pud, addr);
> + if (!pmd)
> + return -ENOMEM;
> + if (ops->k_pud_alloc) {
> + ret = ops->k_pud_alloc(pgd, addr, data);
> + if (ret)
> + return ret;
> + } else {
> + pud = pud_alloc(&init_mm, pgd, addr);
> + if (!pud)
> + return -ENOMEM;
> + }
Generally we prefer to simply *require* that the function vector be filled
in appropriately. So if the caller has no special needs, the caller will
set their gen_map_kern_ops.k_pte_alloc to point at pte_alloc_kernel().
erk, pte_alloc_kernel() is a macro. As is pmd_alloc(), etc. Well, let
that be a lesson to us. What a mess.
I suppose we could go through and convert them all to inlines and then the
compiler will generate an out-of-line copy for us. Better would be to turn
these things into regular, out-of-line C functions.
What a mess.
next prev parent reply other threads:[~2006-12-09 0:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-08 6:56 [RFC] [PATCH] virtual memmap on sparsemem v3 [0/4] introduction KAMEZAWA Hiroyuki
2006-12-08 7:01 ` [RFC] [PATCH] virtual memmap on sparsemem v3 [1/4] map and unmap KAMEZAWA Hiroyuki
2006-12-09 0:28 ` Andrew Morton [this message]
2006-12-09 2:43 ` KAMEZAWA Hiroyuki
2006-12-09 4:52 ` KAMEZAWA Hiroyuki
2006-12-08 7:04 ` [RFC] [PATCH] virtual memmap on sparsemem v3 [2/4] generic virtual mem_map on sparsemem KAMEZAWA Hiroyuki
2006-12-09 12:05 ` Heiko Carstens
2006-12-09 13:17 ` KAMEZAWA Hiroyuki
2006-12-11 6:44 ` KAMEZAWA Hiroyuki
2006-12-08 7:07 ` [RFC] [PATCH] virtual memmap on sparsemem v3 [3/4] static virtual mem_map KAMEZAWA Hiroyuki
2006-12-09 0:30 ` Andrew Morton
2006-12-09 2:49 ` KAMEZAWA Hiroyuki
2006-12-09 3:33 ` Andrew Morton
2006-12-09 3:41 ` KAMEZAWA Hiroyuki
2006-12-09 4:53 ` KAMEZAWA Hiroyuki
2006-12-08 7:08 ` [RFC] [PATCH] virtual memmap on sparsemem v3 [4/4] ia64 support KAMEZAWA Hiroyuki
2006-12-09 4:55 ` KAMEZAWA Hiroyuki
2006-12-09 11:51 ` [RFC] [PATCH] virtual memmap on sparsemem v3 [0/4] introduction Heiko Carstens
2006-12-09 13:21 ` KAMEZAWA Hiroyuki
2006-12-10 19:47 ` Bob Picco
2006-12-11 0:43 ` KAMEZAWA Hiroyuki
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=20061208162819.f809d703.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=apw@shadowen.org \
--cc=clameter@engr.sgi.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.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