Re: bootmem allocator
From: Cyrill Gorcunov
Date: Tue Apr 08 2008 - 12:19:28 EST
[H. Peter Anvin - Mon, Apr 07, 2008 at 09:33:23PM -0700]
> Cyrill Gorcunov wrote:
>> I think it would be a good idea ;) Btw maybe would be better to call
>> memset on the code witch relies on "clear" memory explicitly? So we will
>> clear memory allocated *only* if we really need this.
>
> Are there any users of bootmem which will allocate a significant amount of
> memory and don't need it zeroed?
>
> -hpa
>
Well, the only really significant allocation I found is in
arch/ia64/kernel/iosapi.c:
---[...]---
static struct iosapic_rte_info * __init_refok iosapic_alloc_rte (void)
{
int i;
struct iosapic_rte_info *rte;
int preallocated = 0;
if (!iosapic_kmalloc_ok && list_empty(&free_rte_list)) {
---> rte = alloc_bootmem(sizeof(struct iosapic_rte_info) *
NR_PREALLOCATE_RTE_ENTRIES);
if (!rte)
return NULL;
for (i = 0; i < NR_PREALLOCATE_RTE_ENTRIES; i++, rte++)
list_add(&rte->rte_list, &free_rte_list);
}
if (!list_empty(&free_rte_list)) {
rte = list_entry(free_rte_list.next, struct iosapic_rte_info,
rte_list);
list_del(&rte->rte_list);
preallocated++;
} else {
rte = kmalloc(sizeof(struct iosapic_rte_info), GFP_ATOMIC);
if (!rte)
return NULL;
}
memset(rte, 0, sizeof(struct iosapic_rte_info));
if (preallocated)
rte->flags |= RTE_PREALLOCATED;
return rte;
}
---[...]---
but it requires zeroed memory too. So, no, I didn't found any large
number of bytes allocated by bootmem scheme without needing of its
clearing.
- Cyrill -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/