Linux-kernel mailing list archive 1999-41,: is lock_kernel() required for lookup_swap_cache() and swap_free()?

# is lock_kernel() required for lookup_swap_cache() and swap_free()?

Manfred Spraul (manfreds@colorfullife.com)
Thu, 14 Oct 1999 14:35:43 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Richard B. Johnson: "Re: 2.3.21 No way to boot with loadlin 1.6a"
- Previous message: Tigran Aivazian: "why so many NMIs??? (2.3.21)"

I still try to figure out which mm functions need which locking
primitives:

* do_swap_page() calls lookup_swap_cache() without lock_kernel(), but
the documentation of lookup_swap_cache() says that the function relies
on lock_kernel().

* shrink_mmap() calls __delete_from_swap_cache() without any special
locking. __delete_from_swap_cache() calls swap_free(), and it seems that
this function is not thread-safe.
[__delete_from_swap_cache() also increases a non-atomic global variable,
but this looks like debug code].

Btw, I'm not sure that it is a good thing to add the vma_list_sem for
vma-list changes:
* find_vma() and merge_segments() are "short" functions, lock_kernel()
is no major probem.
* the vma_list semaphore looks like a major change.

We would win a lot _if_ we would modify swap_out(): with vma_list_sem, a
big part of swap_out_mm() could run without the lock_kernel(), but I
doubt that such a patch would go in before 2.5.

    --
    	Manfred

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

- Next message: Richard B. Johnson: "Re: 2.3.21 No way to boot with loadlin 1.6a"
- Previous message: Tigran Aivazian: "why so many NMIs??? (2.3.21)"