* Generalising page walking even more
@ 2002-11-26 19:00 Ingo Oeser
0 siblings, 0 replies; only message in thread
From: Ingo Oeser @ 2002-11-26 19:00 UTC (permalink / raw)
To: akpm; +Cc: linux-mm
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-26 19:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-26 19:00 Generalising page walking even more Ingo Oeser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox