[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0701030818330.31668@localhost.localdomain>
Date: Wed, 3 Jan 2007 08:20:09 -0500 (EST)
From: "Robert P. J. Day" <rpjday@...dspring.com>
To: Arjan van de Ven <arjan@...radead.org>
cc: Folkert van Heusden <folkert@...heusden.com>,
Denis Vlasenko <vda.linux@...glemail.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
On Sun, 31 Dec 2006, Arjan van de Ven wrote:
> So... yes I fully agree with you that it's worth looking at the
> memset( , PAGE_SIZE) users. If they are page aligned, yes absolutely
> make it a clear_page(), I think that's a very good idea. However
> also please check if they've been very recently allocated in that
> code, and if maybe the zeroing allocators are better suited there..
> (or maybe there's even double zeroing going on.. that's be a nice
> gain)
there's certainly some cleanup/speedup that could be done regarding
these numerous "memset(...,0,PAGE_SIZE) calls.
first, there the obvious 1:1 replacement with a call to
"clear_page()" ***if that's appropriate***.
second, there's some possible simplification, given snippets like
this one from arch/sparc/mm/sun4c.c
pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
if (pte)
memset(pte, 0, PAGE_SIZE);
which seems to be an obvious candidate for replacement with:
pte = get_zeroed_page(GFP_KERNEL|__GFP_REPEAT)
no?
finally, there is certainly some "double zeroing" going on, as with
this snippet from drivers/atm/eni.c:
...
eni_dev->rx_map = (struct atm_vcc **) get_zeroed_page(GFP_KERNEL);
^^^^^^^^^^^^^^^
if (!eni_dev->rx_map) {
printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
dev->number);
free_page((unsigned long) eni_dev->free_list);
return -ENOMEM;
}
memset(eni_dev->rx_map,0,PAGE_SIZE); // redundant, no?
...
so, yes, there does appear to be room for cleanup/speedup.
rday
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists