Hi,

In vfree() shouldn't we be dropping vmlist_lock spinlock as soon as we
unlinked the item from the vmlist? I.e. before we free the actual pages
and the vm_struct itself. Or, perhaps it should be done _after_
vmfree_area_pages() but definitely before kfree(tmp) since tmp is no
longer visible outside the function. (My only doubt whether
vmfree_area_pages() should be inside the lock is because those pages may
otherwise be reused for the next vmalloc request).

(actually I put that spinlock in vfree and get_vm_area so at the time it
seemed "obviously correct" but now I am having thoughts that it can still
be optimized more).

Regards,
Tigran

PS. To be specific, here is the patch I had in mind:

--- linux/mm/vmalloc.c  Mon Nov 20 11:56:14 2000
+++ work/mm/vmalloc.c   Wed Nov 22 11:25:29 2000
@@ -214,9 +214,9 @@
        for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
                if (tmp->addr == addr) {
                        *p = tmp->next;
+                       write_unlock(&vmlist_lock);
                        vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);
                        kfree(tmp);
-                       write_unlock(&vmlist_lock);
                        return;
                }
        }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to