Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2227836yba; Fri, 10 May 2019 08:11:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY98pBVTRDiiKPmpLaiGMoT37yvoa1arI7Edbjyl0pklog1W8d/LccXNhc7eLL9BKq0LLl X-Received: by 2002:a17:902:407:: with SMTP id 7mr13744846ple.62.1557501111977; Fri, 10 May 2019 08:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557501111; cv=none; d=google.com; s=arc-20160816; b=zzOctNSJgImRJtzqGVScTdF+xIBjCgcGiE2asJt/797nfyBUCsH/nUMZfWzkNPqtPz oSB7FBfyVhbm+vw0Mrf9Dv3LdHde2jyYO+uut8Iu8tHuIav5EnPz/tZvEqtWu6uFiHj5 bmjPS1IBl7Uwbinpxf44rGWnzOB1zujpOMvF0DFnthtviGTtRnpmOkEqZKHzcRml4uSF dLLn3DDCumsiiBbEi9rB0eEi38kAHZuJks/gHMb0/4NBmg9Po4ChvAdtBh0UdoFU7EDt M1+3KNaR99HrIaJPH50OblKa9M/VOr6z/kwYuvbn1gHcgf099kKCV8R8UcrEMvIy8HJJ I+Mg== 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; bh=q5vcq0afF5GG5zR0EtmsW0Ule6BB1C257to94buYw2U=; b=UJaBdy6k9fI176RUyaOVefXSHJq29fVXyH57hOyAEfla+uREY/xSOLN8WFYHQpO8OC xjkXSV8KbK0mxe2no8JHJ38wG3ngyfCB3FB4nDdq9/nhPaq7a54pSfa24EnYTnLsE9WM gCKHJP1xvNDo/g6LqgbaW+e3wSX408tRx26nvCr+STpyV31t+NRwB+9QVwIfsrvXjfBk e8ocLhGs8trHqu3gjb2XWGwGhoq2JGeqUTxgHlU+/5qSfr9CHdKE6ysas0ROR2Mm8awR S/bc6PbdT6E9Qan1K1nHT8sJuRo7CGwA46cY85+Hntf4uWD9VJE4pQcbhqMOzsbglXIK bvMg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si7929976pfi.146.2019.05.10.08.11.34; Fri, 10 May 2019 08:11:51 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbfEJPKf (ORCPT + 99 others); Fri, 10 May 2019 11:10:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36122 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727346AbfEJPKf (ORCPT ); Fri, 10 May 2019 11:10:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C50C86679; Fri, 10 May 2019 15:10:34 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id EDF0E5D9D5; Fri, 10 May 2019 15:10:27 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 10 May 2019 17:10:32 +0200 (CEST) Date: Fri, 10 May 2019 17:10:25 +0200 From: Oleg Nesterov To: Sultan Alsawaf Cc: Christian Brauner , Daniel Colascione , Suren Baghdasaryan , Steven Rostedt , Tim Murray , Michal Hocko , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Ingo Molnar , Peter Zijlstra , LKML , "open list:ANDROID DRIVERS" , linux-mm , kernel-team , Andy Lutomirski , "Serge E. Hallyn" , Kees Cook , Joel Fernandes Subject: Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android Message-ID: <20190510151024.GA21421@redhat.com> References: <20190318235052.GA65315@google.com> <20190319221415.baov7x6zoz7hvsno@brauner.io> <20190319231020.tdcttojlbmx57gke@brauner.io> <20190320015249.GC129907@google.com> <20190507021622.GA27300@sultan-box.localdomain> <20190507153154.GA5750@redhat.com> <20190507163520.GA1131@sultan-box.localdomain> <20190509155646.GB24526@redhat.com> <20190509183353.GA13018@sultan-box.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509183353.GA13018@sultan-box.localdomain> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 10 May 2019 15:10:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09, Sultan Alsawaf wrote: > > On Thu, May 09, 2019 at 05:56:46PM +0200, Oleg Nesterov wrote: > > Impossible ;) I bet lockdep should report the deadlock as soon as find_victims() > > calls find_lock_task_mm() when you already have a locked victim. > > I hope you're not a betting man ;) I am starting to think I am ;) If you have task1 != task2 this code task_lock(task1); task_lock(task2); should trigger print_deadlock_bug(), task1->alloc_lock and task2->alloc_lock are the "same" lock from lockdep pov, held_lock's will have the same hlock_class(). > CONFIG_PROVE_LOCKING=y OK, > And a printk added in vtsk_is_duplicate() to print when a duplicate is detected, in this case find_lock_task_mm() won't be called, and this is what saves us from the actual deadlock. > and my phone's memory cut in half to make simple_lmk do something, this is what > I observed: > taimen:/ # dmesg | grep lockdep > [ 0.000000] \x09RCU lockdep checking is enabled. this reports that CONFIG_PROVE_RCU is enabled ;) > taimen:/ # dmesg | grep simple_lmk > [ 23.211091] simple_lmk: Killing android.carrier with adj 906 to free 37420 kiB > [ 23.211160] simple_lmk: Killing oadcastreceiver with adj 906 to free 36784 kiB yes, looks like simple_lmk has at least 2 locked victims. And I have no idea why you do not see anything else in dmesg. May be debug_locks_off() was already called. But see above, "grep lockdep" won't work. Perhaps you can do "grep -e WARNING -e BUG -e locking". Oleg.