Re: [BUGFIX][PATCH 2/3] kcore: fix vread/vwrite to be aware ofholes.

From: Andrew Morton
Date: Tue Aug 04 2009 - 21:25:13 EST


On Wed, 5 Aug 2009 10:08:43 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> > > + /*
> > > + * To do safe access to this _mapped_ area, we need
> > > + * lock. But adding lock here means that we need to add
> > > + * overhead of vmalloc()/vfree() calles for this _debug_
> > > + * interface, rarely used. Instead of that, we'll use
> > > + * kmap() and get small overhead in this access function.
> > > + */
> > > + if (p) {
> > > + /* we can expect USR1 is not used */
> >
> > It would be nice if the comment were to explain _why_ KM_USER1 is known
> > to be free here.
> >
> ok, will do. Hmm, but KM_USR0 is better ?
> I'm not sure difference between KM_USR0/KM_USR1...

KM_USER0 is conventionally the first one to use. We only use KM_USER1
if it is known that KM_USER0 is already used.

>
>
> >
> > > + void *map = kmap_atomic(p, KM_USER1);
> > > + memcpy(buf, map + offset, length);
> > > + kunmap_atomic(map, KM_USER1);
> >
> > Can use clear_highpage().
> >
> ah, "buf" is expected to be kmalloc'ed buffer. I'll explain it in Usage
> or adds comment.
>

argh, memcpy != memset. I knew that ;)
--
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/