From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with ESMTP id 569225F0001 for ; Mon, 2 Feb 2009 08:09:13 -0500 (EST) Subject: Re: [BUG??] Deadlock between kswapd and sys_inotify_add_watch(lockdep report) From: Peter Zijlstra In-Reply-To: <20090202115627.GB13532@barrios-desktop> References: <20090202101735.GA12757@barrios-desktop> <28c262360902020225w6419089ft2dda30da9dfb32a9@mail.gmail.com> <1233571202.4787.124.camel@laptop> <20090202112721.GA13532@barrios-desktop> <1233575085.4787.140.camel@laptop> <20090202115627.GB13532@barrios-desktop> Content-Type: text/plain Date: Mon, 02 Feb 2009 14:09:07 +0100 Message-Id: <1233580147.4787.207.camel@laptop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: MinChan Kim Cc: Nick Piggin , linux kernel , linux mm , Ingo Molnar List-ID: On Mon, 2009-02-02 at 20:56 +0900, MinChan Kim wrote: > Thanks for kind explanation. :) > Unfortunately, I still have a question. :( No problem :-) > > > I think if reclaim context which have GFP_FS already have lock A and then > > > do pageout, if writepage need the lock A, we have to catch such a case. > > > I thought Nick's patch's goal catchs such a case. > > > > Correct, it exactly does that. > > But, I think such a case can be caught by lockdep of recursive detection > which is existed long time ago by making you. (Ingo wrote that code) > what's difference Nick's patch and recursive lockdep ? Very good question indeed. Every time I started to write an answer I realize its wrong. The below is half the answer: /* * Check whether we are holding such a class already. * * (Note that this has to be done separately, because the graph cannot * detect such classes of deadlocks.) * * Returns: 0 on deadlock detected, 1 on OK, 2 on recursive read */ static int check_deadlock(struct task_struct *curr, struct held_lock *next, struct lockdep_map *next_instance, int read) So in order for the reclaim report to trigger we have to actually hit that code path that has the recursion in it. The reclaim context annotation by Nick ensures we detect such cases without having to do that. The second half, to which I cannot seem to get a decent answer to atm, is why the recursion case isn't detected by the graph. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org