Received: by 10.223.176.5 with SMTP id f5csp881130wra; Wed, 7 Feb 2018 09:01:12 -0800 (PST) X-Google-Smtp-Source: AH8x226NTF0TWFQPph8QrS6G+ADJteaq+tOTKyxbZWIS/xM+qUlSmyD1CApiXhaLEscTL9B3e/ck X-Received: by 10.101.72.11 with SMTP id h11mr5423486pgs.386.1518022872109; Wed, 07 Feb 2018 09:01:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518022872; cv=none; d=google.com; s=arc-20160816; b=Y45883H25rE++a6PrksBfoUNj1pI4Qt3xx90Z9j/8Yx+TD8Vl93++OnO07t/QCS9JB pV04UpWdiIfn8BIyYO4E3bIYRvtDV03H9HssXowSzfujgfwIGGlScsftH5crYVbXMdxn N3o2VVB2/yOgkyUMDWrRzcmd3f31R8WQ1BorULlhKqgDMO7p2E+3E+WHdFUtJuXvM6X6 IgHrIXGAEeMLWpQxQ6jyhtCjAGp7VkEYFbukhdpuNcMUtzbi/cf3wlNwINRezdS8hCJW XlH7VSSo3nCoJx54F/b3gqG/r5z8b1+Jmlrpz1H/xpZ6P8YtGnLffpuoumIjpKe0mbLI Qyrw== 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:arc-authentication-results; bh=nQbP/slOjIdTJB00waHd2U6qmUjv+VVJeRIPmg5JgSg=; b=h14qffTSQoOdKz7RQAYUXnHOhrc6umHESMAl0BbfHXTEzB0e5w8eA4UJyvrz7ZNy9U q+yed6WPGvP1ZzO2cS+q/olPSqsDhFqjXcZMNWoIerKQiER2FiDELk5iSSCFsir5sHNG tWk6WYnimybWjNXPaRV3vz3ogONkBERgIIm1cXWDwBRurnUpAWk0sVakYo+V2FR181Nz VZXYS4JCVbBWvc0be4x/7gSwa/wHwJ3hINaKn5+/jKMGSx9Tjchpd0bguSBdF9hMoj9f +FVz0PLr2J06OMzQ/Hsif70lXHlgj4XqADCsa0+X9tcVEmh93fvpsIaWrMlCBjip5tmN 9d3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kursdhDf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si1336789plo.170.2018.02.07.09.00.57; Wed, 07 Feb 2018 09:01:12 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kursdhDf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754789AbeBGQ6H (ORCPT + 99 others); Wed, 7 Feb 2018 11:58:07 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:39011 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754715AbeBGQ6F (ORCPT ); Wed, 7 Feb 2018 11:58:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nQbP/slOjIdTJB00waHd2U6qmUjv+VVJeRIPmg5JgSg=; b=kursdhDfaQCJfZNMdbL+tR+4M qR8qjAw86cXeujstr6wDm1s7DlJxcxFPy7wx5WEyEvjZJZS9VG1P9Ji92gzWLw8pxGc91ivXKCdLO szgN0dWPyywWFCk8HIneTIu0Z3rDtggMl0mua0j78I/bWeS5CsvH1a/isx6tunGz2Wqmu7jN1D3wH KqOshXZof1D6ME81C5MEJ2Z5W9Hwj0Mf61ojCriZkdMZC/ZD+W6pfRZkjBPq64NYfWoYtx037A9b0 Maaz2j9P3GXi8EEm51RAtK+oorTpWm8JxOr85Wxqr4Vz72uXiggxkD0jjVwKz5BAuxAtBZYYgjfpR 2vvIuLWVQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ejT2q-0004t0-Dy; Wed, 07 Feb 2018 16:58:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AE0E92029F9FA; Wed, 7 Feb 2018 17:58:02 +0100 (CET) Date: Wed, 7 Feb 2018 17:58:02 +0100 From: Peter Zijlstra To: Joel Fernandes Cc: LKML , Michal Hocko , Minchan Kim , "open list:MEMORY MANAGEMENT" Subject: Re: [PATCH RFC] ashmem: Fix lockdep RECLAIM_FS false positive Message-ID: <20180207165802.GC25219@hirez.programming.kicks-ass.net> References: <20180206004903.224390-1-joelaf@google.com> <20180207080740.GH2269@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 08:09:36AM -0800, Joel Fernandes wrote: > Hi Peter, > > On Wed, Feb 7, 2018 at 12:07 AM, Peter Zijlstra wrote: > > On Mon, Feb 05, 2018 at 04:49:03PM -0800, Joel Fernandes wrote: > > > >> [ 2115.359650] -(1)[106:kswapd0]================================= > >> [ 2115.359665] -(1)[106:kswapd0][ INFO: inconsistent lock state ] > >> [ 2115.359684] -(1)[106:kswapd0]4.9.60+ #2 Tainted: G W O > >> [ 2115.359699] -(1)[106:kswapd0]--------------------------------- > >> [ 2115.359715] -(1)[106:kswapd0]inconsistent {RECLAIM_FS-ON-W} -> > >> {IN-RECLAIM_FS-W} usage. > > > > Please don't wrap log output, this is unreadable :/ > > Sorry about that, here's the unwrapped output, I'll fix the commit > message in next rev: https://pastebin.com/e0BNGkaN So if you trim that leading garbage: "[ 2115.359650] -(1)[106:kswapd0]" you instantly have half you screen back. > > Also, the output is from an ancient kernel and doesn't match the current > > code. > > Right, however the driver hasn't changed and I don't see immediately > how lockdep handles this differently upstream, so I thought of fixing > it upstream. Well, the annotation got a complete rewrite. Granted, it _should_ be similar, but the output will be different. > The bail out happens when GFP_FS is *not* set. Argh, reading is hard. > Lockdep reports this issue when GFP_FS is infact set, and we enter > this path and acquire the lock. So lockdep seems to be doing the right > thing however by design it is reporting a false-positive. So I'm not seeing how its a false positive. fs/inode.c sets a different lock class per filesystem type. So recursing on an i_mutex within a filesystem does sound dodgy. > The real issue is that the lock being acquired is of the same lock > class and a different lock instance is acquired under GFP_FS that > happens to be of the same class. > > So the issue seems to me to be: > Process A kswapd > --------- ------ > acquire i_mutex Enter RECLAIM_FS > > Enter RECLAIM_FS acquire different i_mutex That's not a false positive, that's a 2 process way of writing i_mutex recursion. What are the rules of acquiring two i_mutexes within a filesystem? > Neil tried to fix this sometime back: > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg623909.html > but it was kind of NAK'ed. So that got nacked because Neil tried to fix it in the vfs core. Also not entirely sure that's the same problem.