mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Folkert van Heusden <folkert@vanheusden.com>,
	Denis Vlasenko <vda.linux@googlemail.com>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
Date: Wed, 3 Jan 2007 08:20:09 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701030818330.31668@localhost.localdomain> (raw)
In-Reply-To: <1167586995.20929.829.camel@laptopd505.fenrus.org>

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



      reply	other threads:[~2007-01-03 13:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-29  6:16 Robert P. J. Day
2006-12-30 20:49 ` Denis Vlasenko
2006-12-30 22:08   ` Robert P. J. Day
2006-12-30 22:40     ` Denis Vlasenko
2007-01-03  6:23       ` dean gaudet
2006-12-30 22:45     ` Arjan van de Ven
2006-12-30 23:04       ` Robert P. J. Day
2006-12-31 18:39         ` Paul Mundt
2006-12-31 19:04           ` Robert P. J. Day
2007-01-01  1:59             ` Folkert van Heusden
2007-01-01  8:33               ` Robert P. J. Day
2007-01-01 10:14                 ` Arjan van de Ven
2007-01-01 10:27                   ` Robert P. J. Day
2007-01-01 19:05                     ` Dave Jones
2007-01-01  8:42               ` Paul Mundt
2007-01-01 17:09                 ` Randy Dunlap
2006-12-31 13:39       ` Folkert van Heusden
2006-12-31 13:45         ` Arjan van de Ven
2006-12-31 16:39           ` Robert P. J. Day
2006-12-31 17:43             ` Arjan van de Ven
2007-01-03 13:20               ` Robert P. J. Day [this message]

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=Pine.LNX.4.64.0701030818330.31668@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=arjan@infradead.org \
    --cc=folkert@vanheusden.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda.linux@googlemail.com \
    /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

all inboxes | Powered by JetHome®