linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: akpm@digeo.com
Cc: linux-mm@kvack.org
Subject: Generalising page walking even more
Date: Tue, 26 Nov 2002 20:00:23 +0100	[thread overview]
Message-ID: <20021126200023.Q659@nightmaster.csn.tu-chemnitz.de> (raw)

Hi Andrew,
hi linux-mm readers,

Gerd Knorr pointed me to another common used function, which
might need generalisation.

mm/memory.c:vmalloc_to_page() is also some kind of page walker,
but is usally called in a loop, which is really inefficient and
causes a lot of preemption enable/disable calls.

My plan is to put some generalisation into mm/page_walk.c
allowing also to walk a vmalloc range and collect pages or sgls
from there.

Routines for fixing up after DMA transfers are also nice to have.
My idea is a function like this for pages and sgls.

/* If we wrote into the page, we must tell that the VM system.
 * @numdirty is the number of pages dirtied. It may be zero.
 */
void fixup_sgl_usage(struct gup_add_sgls *gup, unsigned int numdirty) {
        unsigned int i=0;

        BUG_ON(gup->count < numdirty);
        WARN_ON(!(gup->pw.vm_flags & (VM_WRITE|VM_MAYWRITE)));

        for (; i < numdirty; i++) {
                set_page_dirty(gup->sgl[i].page);
                page_cache_release(gup->sgl[i].page);
        }

        for (; i < gup->count; i++) {
                page_cache_release(gup->sgl[i].page);
        }
}

This is to assist driver writers and to remove more vm knowledge
from the drivers, since driver writers are usually no VM gurus.

What do you think?

Regards

Ingo Oeser
-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

                 reply	other threads:[~2002-11-26 19:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021126200023.Q659@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=akpm@digeo.com \
    --cc=linux-mm@kvack.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