Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2013129ybe; Thu, 12 Sep 2019 03:10:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLnabtAgBb+CkhoSySfpr2lWmMXrGK79RdP/i+RoJ4b+nfqviu+cHKwBZRpAW7STecfL4N X-Received: by 2002:a05:6402:17eb:: with SMTP id t11mr41336408edy.107.1568283003615; Thu, 12 Sep 2019 03:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568283003; cv=none; d=google.com; s=arc-20160816; b=wnfC6/xarZJ1RZPH8qvIP0Tf+kXwcuYEANvA+2yA3rRsWayFwSqvD+qbDEf6ir/bVv mFZPBvNx1dRnwGhQs3jWa+PyqiCnN/sd0Aie4TZAp4xbgwSGzO4LgMP9RVj9Ut6Vg3hP EcL5Wp0iAzS+UZJE4O4PSc+N3w9B2hGCNV/wpDJx44oYhFHqjeK6ZHLJE01+7sGpMgvl jX5bQRJ4LRIt2taFSgcOc25AdfA1fjLiVodee9vTe1SUd0VsFfaf0S5pRhbAwvI93Iuu hDMFxVDXoQQca9miqLbUaMd9+b9cgF6FwmabzoihHKB+FifaGdGcJbaTE9uDJdrMYKEh 8XCA== 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=b/rIExj7B4h6eC4mHl71VjTXyhp29mEK5iBcqAyTdGg=; b=bT491T+38Lp9RmP2CXPcqHFxyzAnQBxv16J11Ot/wXiYUD/YdSkgNJJNvdZp7ug6ZM nNhqCqBqoGFY8xxLQYDxbMGBB9W/XUFLAARB6XQRvMs3wWVBUQxxYjkUv9/KEvPyMLB8 JJ2ZonbsjXv8Bqy5GlzueJjaspFAlD+UoYSH81jS0N4VNeXGkDQNaOhJMM9GsTEEFbiR b1bF8PIISFRN/xh1S5VfnpFNFf7XY64MmGE9vywhNzhYcWXCJ84tDKj9iI9ITvei6RW/ OcdUjv/RXEDHyMsje2YisFpieu0VL7TTPUOawiEGD6pR804rsO6RS08+UBBAUjbfl7QM UwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=AW5DrAcs; 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 d11si12685919edh.407.2019.09.12.03.09.40; Thu, 12 Sep 2019 03:10:03 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=AW5DrAcs; 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 S1731001AbfILKEa (ORCPT + 99 others); Thu, 12 Sep 2019 06:04:30 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:38885 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730458AbfILKEa (ORCPT ); Thu, 12 Sep 2019 06:04:30 -0400 Received: by mail-ed1-f67.google.com with SMTP id a23so21179024edv.5 for ; Thu, 12 Sep 2019 03:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=b/rIExj7B4h6eC4mHl71VjTXyhp29mEK5iBcqAyTdGg=; b=AW5DrAcscw4bvqq/1xyyZySmm8GCobspqFQVzbhGGa04IJS4RWFuqH/svrDz92T0rJ K84vjWZTjUK563+t6r4w7iO/iBhPPQeFMP0di/DtMFPh1IRbUsKPHJ3Oxc8l5evb5UGg AfePbOriyQOkGtZCo4vvVowEroFGCCgqj9163AQu4qax5zQTSWzUA7DX4U0ePAc7Ag1b YNopkmk4QhOPStos9FVkKThvkxZGJpYafQ7YApID3mWeXjMS/IPoa/39Gb9v8Bp4qWNP 38dOKgHwNl/hc/f3HZiPwdImwxrg3FY1wa8H6+gJUDAlPeS/lTDQfuoz83kbyEHNCcC/ I6tg== 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=b/rIExj7B4h6eC4mHl71VjTXyhp29mEK5iBcqAyTdGg=; b=GC6NR+NdSFfnrd49UjKmTbSn9njS/H88nNQPB/HIvplKK8jWDF3+O5YJRqG1WmxH20 LIejvNOmYwg+2YjhDnblfgWuOMNvZJt8y7QbcwXQ7xrClcw8wkiXuN94xHnNlLIBNZ+i wW+le7X+iP1kgPRWainQ/3hNOyePc4BT2FWCfp3CIIqaOQjMGUPVMYF4IrfcUpyHZdQ2 LHQUh8Hju/AhaHkDOG3by4so0eF1gScd8Z1DzGb/Qr7hxIuLvMvtbYHACB4OUGI7MWdB TazFenC2qI6z846b5iI/PjYOn3OByJp2EuIbDuVxOi6BEGlOc25+Et60vx/Cmbs4MSK5 KFfw== X-Gm-Message-State: APjAAAUWEVxZz8e8tqVuzIPi2FUF1VmqV8a81MtbQTOT9hvH4RgMJMU/ cWRvTzPu+mbcNZWuwRGfCiqY6Q== X-Received: by 2002:a17:906:3583:: with SMTP id o3mr11419151ejb.224.1568282668660; Thu, 12 Sep 2019 03:04:28 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id kt24sm2791872ejb.72.2019.09.12.03.04.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Sep 2019 03:04:27 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 2F31C100B4A; Thu, 12 Sep 2019 13:04:29 +0300 (+03) Date: Thu, 12 Sep 2019 13:04:29 +0300 From: "Kirill A. Shutemov" To: Yu Zhao Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] mm: avoid slub allocation while holding list_lock Message-ID: <20190912100429.fk5er66aostbtvyi@box> References: <20190912004401.jdemtajrspetk3fh@box> <20190912023111.219636-1-yuzhao@google.com> <20190912023111.219636-3-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190912023111.219636-3-yuzhao@google.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 08:31:10PM -0600, Yu Zhao wrote: > If we are already under list_lock, don't call kmalloc(). Otherwise we > will run into deadlock because kmalloc() also tries to grab the same > lock. > > Fixing the problem by using a static bitmap instead. > > WARNING: possible recursive locking detected > -------------------------------------------- > mount-encrypted/4921 is trying to acquire lock: > (&(&n->list_lock)->rlock){-.-.}, at: ___slab_alloc+0x104/0x437 > > but task is already holding lock: > (&(&n->list_lock)->rlock){-.-.}, at: __kmem_cache_shutdown+0x81/0x3cb > > other info that might help us debug this: > Possible unsafe locking scenario: > > CPU0 > ---- > lock(&(&n->list_lock)->rlock); > lock(&(&n->list_lock)->rlock); > > *** DEADLOCK *** > > Signed-off-by: Yu Zhao Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov