The patch titled Subject: swapfile: initialize spinlock for swap_cluster_info has been added to the -mm tree. Its filename is mm-swap-add-cluster-lock-v5-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-swap-add-cluster-lock-v5-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-swap-add-cluster-lock-v5-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Minchan Kim <minchan@xxxxxxxxxx> Subject: swapfile: initialize spinlock for swap_cluster_info We changed swap_cluster_info lock from bit_spin_lock to spinlock so we need to initialize the spinlock before the using. Otherwise, lockdep is broken. Link: http://lkml.kernel.org/r/1486434945-29753-1-git-send-email-minchan@xxxxxxxxxx Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff -puN mm/swapfile.c~mm-swap-add-cluster-lock-v5-fix mm/swapfile.c --- a/mm/swapfile.c~mm-swap-add-cluster-lock-v5-fix +++ a/mm/swapfile.c @@ -2591,6 +2591,7 @@ SYSCALL_DEFINE2(swapon, const char __use if (p->bdev && blk_queue_nonrot(bdev_get_queue(p->bdev))) { int cpu; + unsigned long ci, nr_cluster; p->flags |= SWP_SOLIDSTATE; /* @@ -2598,13 +2599,17 @@ SYSCALL_DEFINE2(swapon, const char __use * SSD */ p->cluster_next = 1 + (prandom_u32() % p->highest_bit); + nr_cluster = DIV_ROUND_UP(maxpages, SWAPFILE_CLUSTER); - cluster_info = vzalloc(DIV_ROUND_UP(maxpages, - SWAPFILE_CLUSTER) * sizeof(*cluster_info)); + cluster_info = vzalloc(nr_cluster * sizeof(*cluster_info)); if (!cluster_info) { error = -ENOMEM; goto bad_swap; } + + for (ci = 0; ci < nr_cluster; ci++) + spin_lock_init(&((cluster_info + ci)->lock)); + p->percpu_cluster = alloc_percpu(struct percpu_cluster); if (!p->percpu_cluster) { error = -ENOMEM; _ Patches currently in -mm which might be from minchan@xxxxxxxxxx are mm-swap-add-cluster-lock-v5-fix.patch zram-remove-waitqueue-for-io-done.patch zram-extend-zero-pages-to-same-element-pages-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html