Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1947954imu; Wed, 28 Nov 2018 18:45:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UCtLB9Hl/m5t6DY62HO+asUc5HA/93P6+Dz0gL7TzVnnpdExrksN+l6gIFH/0Hnt6HmnX8 X-Received: by 2002:a63:1a0c:: with SMTP id a12mr34737744pga.157.1543459523158; Wed, 28 Nov 2018 18:45:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543459523; cv=none; d=google.com; s=arc-20160816; b=JaYH/NOKqIknlmMQiSNuUVmDf/mDn4UtBYM0Cjs6OXcOYRwi9iYVaQqqs9yMdu2UMg xQ2MGUXCYktu5rZ0JM2xDNtoTxe36wWpXBdAROTr+WEGLXACwXKZyRQW3yB3x1jS1q4q QiI+mtHxw/GvsCAG9AJXLJLJJvzG5nXL3SfGIUs3DBl214xaqpKh7ap+l+nbfzB3hyNK oWGyUahVTZBl6Ut/Zdb46AihTuQW91RPRXpcNSNbsMWW1RVtIKwySyL0YcTAjI/JxLb0 TfSDGk4PVHn3yaXp03wia+HBo0qWa7YS7yxMH+zoHkWvFX0TwU7AWQpsgeqN3WWxn+94 MDqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sy0TEUwUKFbfkqVGIbmjs4BRdnwvbbu9XWWoJmJzJGw=; b=akCdwPK729Jl7eEmkVk2YcP17mgOI5Mz8G6C2jRhjs9v4q+QqqjcGeJzZ5oymtG9lx MGTQANrJMkBzPCV9viaxW0fJs/C+LCiDil/CPQndHBwxHZt7+5TGFMCHcfxHDNtFVuOd xrRDyDDv8z3bBdV6b4KTJYzqEhAO/LqFjnbKxIEN1KF8XpubJ/UTkLHvqsoWoBIry5XE tWZjQcc6j6zkxW05/fqHo7/z6gs5+sAvyJHst7kE9KuGAK5zBNHzXqL8K7Fs6fmC9xRS LlxzAZMLEyEyLivtpFltn3OGJxVzPgpZqCi48BLEg0ToRI+46nIleZ6yOpzLEflG+pQW hfkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gUVH0DHp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23si452539pgu.359.2018.11.28.18.45.08; Wed, 28 Nov 2018 18:45:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gUVH0DHp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727529AbeK2NrZ (ORCPT + 99 others); Thu, 29 Nov 2018 08:47:25 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34356 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbeK2NrZ (ORCPT ); Thu, 29 Nov 2018 08:47:25 -0500 Received: by mail-pg1-f196.google.com with SMTP id 17so231066pgg.1 for ; Wed, 28 Nov 2018 18:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sy0TEUwUKFbfkqVGIbmjs4BRdnwvbbu9XWWoJmJzJGw=; b=gUVH0DHpimjEbUft/30wWVbeMKzCX9DcD+XApIJAdQYqxGvpigcei4dpzEHi9w1xfz 9xZ0o3lFiAXkTKzlM+f6P/wt3T1lgNel9XT0BcoKzmN39SBQf20OENqolgjnJUPha8+L eIrAh+FHNk4hLiLQ/JxqtxaUa01+mw0MYg82YCKF1pj9eLwjvmaphCwGP7AkHA9NYCVi VpkIzncXcsFahjQ/SUhPAbkwIxK6qFRF9p4MwMUU53sWnkoGnCswu27xXA5iEQ80J5qr iZimNriviNoFBAKdgDXToEg9RUdqH2+haOu44BKWCoQAjpKL/doPoCkUm14AWNuMNo5h cvYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sy0TEUwUKFbfkqVGIbmjs4BRdnwvbbu9XWWoJmJzJGw=; b=sMI/roimttmpti1gl20myeyJIaU4XQfg3yTUDf6t+rrfet7oOePCaiHQIYrosjjeKI Uz9ijDrYGqdwOUsWklLtaE8sSyk2yf2T2QD3WTokFvgQuQYgvaqkENuXUT1TsLGNHnGD B1IsvRLrGwDHLqAuNTfGovBgRA3rXM/47HIu+lgkAZSZpbR1O4TzQ8zGNcUq73B+uOpQ naHZsgX5MPfNcjKnRfh7v54aZnYx2DhBWOGeETWPs1ZTW8ytWemomJ5xHag5l9V8N8Wm ctGlGVTt1mTrnIZY0Q8gWXshjLcKgDjI8K5kJ24r1U2QeSfBJt6jfqfbiCm8w5ZPjiku xl2w== X-Gm-Message-State: AA+aEWb+YxdHSSrJRYdigpHx8EoSqC+19l+vN6I1V03noyh0CrwlLH2S REaGaTdmz9kl+4MZJgvapLk= X-Received: by 2002:a62:1112:: with SMTP id z18mr19984847pfi.173.1543459418310; Wed, 28 Nov 2018 18:43:38 -0800 (PST) Received: from localhost ([175.223.15.27]) by smtp.gmail.com with ESMTPSA id q1sm349695pgs.14.2018.11.28.18.43.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 18:43:37 -0800 (PST) Date: Thu, 29 Nov 2018 11:43:34 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Andrew Morton , LKML , Sergey Senozhatsky , Joey Pabalinas Subject: Re: [PATCH v3 1/7] zram: fix lockdep warning of free block handling Message-ID: <20181129024334.GD6379@jagdpanzerIV> References: <20181127055429.251614-1-minchan@kernel.org> <20181127055429.251614-2-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127055429.251614-2-minchan@kernel.org> User-Agent: Mutt/1.11.0 (2018-11-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (11/27/18 14:54), Minchan Kim wrote: > With writeback feature, zram_slot_free_notify could be called > in softirq context by end_swap_bio_read. However, bitmap_lock > is not aware of that so lockdep yell out. Thanks. > > get_entry_bdev > spin_lock(bitmap->lock); > irq > softirq > end_swap_bio_read > zram_slot_free_notify > zram_slot_lock <-- deadlock prone > zram_free_page > put_entry_bdev > spin_lock(bitmap->lock); <-- deadlock prone > > With akpm's suggestion(i.e. bitmap operation is already atomic), > we could remove bitmap lock. It might fail to find a empty slot > if serious contention happens. However, it's not severe problem > because huge page writeback has already possiblity to fail if there > is severe memory pressure. Worst case is just keeping > the incompressible in memory, not storage. > > The other problem is zram_slot_lock in zram_slot_slot_free_notify. > To make it safe is this patch introduces zram_slot_trylock where > zram_slot_free_notify uses it. Although it's rare to be contented, > this patch adds new debug stat "miss_free" to keep monitoring > how often it happens. > > Signed-off-by: Minchan Kim Reviewed-by: Sergey Senozhatsky -ss