Re: [patch 2/14] x86, mm: add release_locked_buffer_on_behalf

From: Oleg Nesterov
Date: Fri Mar 27 2009 - 10:25:58 EST


On 03/27, Markus Metzger wrote:
>
> -void release_locked_buffer(void *buffer, size_t size)
> +void release_locked_buffer_on_behalf(struct mm_struct *mm,
> + void *buffer, size_t size)
> {
> unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
>
> - down_write(&current->mm->mmap_sem);
> + down_write(&mm->mmap_sem);
>
> - current->mm->total_vm -= pgsz;
> - current->mm->locked_vm -= pgsz;
> + mm->total_vm -= pgsz;
> + mm->locked_vm -= pgsz;
>
> - up_write(&current->mm->mmap_sem);
> + up_write(&mm->mmap_sem);
> }

If you change this helper, perhaps you can remove the "void *buffer"
argument? It is not used. Actually, this helper should be renamed.
It doesn't free the memory, it only updates mm->xxx_vm.

Oleg.

--
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/