Messages in this thread | | | Date | Mon, 17 Nov 2008 09:58:07 +0100 | From | Jens Axboe <> | Subject | Re: [PATCH] Fix kunmap() argument in sg_miter_stop |
| |
On Mon, Nov 17 2008, Ingo Molnar wrote: > > * Jens Axboe <jens.axboe@oracle.com> wrote: > > > On Mon, Nov 17 2008, Ingo Molnar wrote: > > > > > > * Jens Axboe <jens.axboe@oracle.com> wrote: > > > > > > > +#define kunmap(p) \ > > > > + do { \ > > > > + struct page *__p; \ > > > > + (void) (&__p == &(p)); \ > > > > + __kunmap(p); \ > > > > + } while (0) > > > > + > > > > +#define kunmap_atomic(a, t) \ > > > > + do { \ > > > > + void *__p; \ > > > > + (void) (&__p == &(a)); \ > > > > + __kunmap_atomic(a, t); \ > > > > + } while (0) > > > > > > Agreed - but please use the typecheck() primitive. (linux/typecheck.h) > > > > Neat, didn't know about that, thanks. > > and ack on your patch obviously. Feel free to push it via the block > tree straight away, it doesnt collide with anything pending in the x86 > tree. > > Acked-by: Ingo Molnar <mingo@elte.hu>
The kunmap() bit is easy to do as I mentioned, but the kunmap_atomic() gets a bit more ugly. Lots of users can just be switched to void * types, but some get ugly like:
static struct page **shmem_dir_map(struct page *page) return (struct page **)kmap_atomic(page, KM_USER0); } -static inline void shmem_dir_unmap(struct page **dir) +static inline void shmem_dir_unmap(void *dir) { kunmap_atomic(dir, KM_USER0); }
and others again like fs/exec.c:remove_arg_zero() would really like to use a char * type since it dereferences it.
I think the kunmap_atomic() change it the most needed part of the patch, but I don't think it can come for free (eg, we have to add variable to the above function).
-- Jens Axboe
| |