ANDROID: Fixed the KMI corruption issue caused by the patch of 72d04bdc.
Due to 72d04bdc ("sbitmap: fix io hung due to race on sbitmap_word ::cleared") directly adding spinlock_t swap_1ock to struct sbitmap_word in sbitmap.h, KMI was damaged. In order to achieve functionality without damaging KMI, we can only apply for a block of memory with a size of map_nr * (sizeof (* sb ->map)+sizeof(spinlock_t)) to ensure that each struct sbitmap-word receives protection from spinlock. The actual memory distribution used is as follows: ---------------------- struct sbitmap_word[0] ...................... struct sbitmap_word[n] ----------------------- spinlock_t swap_lock[0] ....................... spinlock_t swap_lock[n] ---------------------- sbitmap_word[0] corresponds to swap_lock[0], and sbitmap_word[n] corresponds to swap_lock[n], and so on. Fixes: ea86ea2c ("sbitmap: ammortize cost of clearing bits") Signed-off-by:Yang Yang <yang.yang@vivo.com> Reviewed-by:
Ming Lei <ming.lei@redhat.com> Reviewed-by:
Bart Van Assche <bvanassche@acm.org> Bug: 382398521 Link: https://lore.kernel.org/r/20240716082644.659566-1-yang.yang@vivo.com Change-Id: Idcab0dd5fd7c3147efd05dd6cc51757c2b0464f6 Signed-off-by:
liuyu <liuyu@allwinnertech.com> Bug: 401681610
Please register or sign in to comment