Re: removing the global lock from sys_brk()

Linus Torvalds (torvalds@transmeta.com)
Thu, 3 Jun 1999 22:19:59 -0700 (PDT)


On Thu, 3 Jun 1999, Chuck Lever wrote:
>
> is this more like what you had in mind?

[ deleted ]

Yes, this looks a lot more like what I had in mind. I'll read it through
once more, but this is basically how I envisioned it. The only thing that
looks suspect is that I don't think we should need the kernel lock even
around the merge_segments() call in do_brk():

> +
> + /*
> + * merge_segments may merge our vma, so we can't refer to it
> + * after the call. Save the values we need now ...
> + */
> + flags = vma->vm_flags;
> + addr = vma->vm_start;
> + lock_kernel();
> + insert_vm_struct(mm, vma);
> + merge_segments(mm, vma->vm_start, vma->vm_end);
> + unlock_kernel();

because we're guaranteed to merge only a segment without any inode or
anything else, so there's no way we can do anything bad even conceptually:
the mm semaphore should protect us quite sufficiently.

Or is there something you noticed that I missed?

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/