Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp817405imm; Wed, 23 May 2018 06:06:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZgG0F/7eb0s9Mz5eUf+2+tVZrDoxYs0tJXU3d55NL1buwlSd8jLRzaQ5d03i2YFVECbkM X-Received: by 2002:a65:590e:: with SMTP id f14-v6mr2302213pgu.282.1527080780687; Wed, 23 May 2018 06:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527080780; cv=none; d=google.com; s=arc-20160816; b=mkQLYO928mqR+0BToNi8qJYJMhPPAc2b3pq7+gyJY9rbdVzMZ+ChhskYwEWG0twZlD cKWzzc2ka/+2y5H2YEUMu+Vw7jeiUXRhnhBJ4ifR5yh2SyOoPi3H/Q3g4XDhD0wY7UaQ X6QYoFYhfWbDjR/gjGUlHdZE6qFN4zGUfVId3jkNa/kshKtgBJes1jOc+bDTvN4zQ/zb OyOVaiZWgA5w/7+C5Usp1AU6NrNzKnnzumfJhMWtdpEhghCbO0kzirBCy1e0fkXRkfVu PDSw4jhspmr24SvUgBvToqCLRjF/7onA35nFc/aFVSxwrx0RyWTroSczTeUmFb6SSCmt rw0A== 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:arc-authentication-results; bh=5u2EsrinaPV8AHwdAfJd2//mZIdDekhH05CMxY3gT+Y=; b=jqs4c65Ohv8EHfsWIqUkDPNAItJt3VnhW5z19JfuURk2qhhcohMA3xGLj4wv64iWzT Bt438JrmbdnuUifMOlH4C5xyMP4M2/HoxPjOv9M3DpN26l5aeQqyNOPdvT78vfrnOddj 48oVCkyCMEhRG5By2cd4QSXPVfUY7XcpfcjCKVi8nmlHuZ9wpKwOBUpfrVUBvrLAmVke Ct3uzhBS0+HvYDA5LAPnHb8jtJjyarV+tFAH+jgoJPFgQfVz7+nWbmS06iL96Kry07ek c2HDPy23ehFtiLwiNM4D7cDd5OWaqIGHPAxkBdd5rYuMQrEpN5cnbj5VBL9RNDJQlSmS Y3eQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 99-v6si18316835plc.362.2018.05.23.06.06.04; Wed, 23 May 2018 06:06:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932940AbeEWNFW (ORCPT + 99 others); Wed, 23 May 2018 09:05:22 -0400 Received: from foss.arm.com ([217.140.101.70]:54874 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932089AbeEWNFV (ORCPT ); Wed, 23 May 2018 09:05:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7BDF180D; Wed, 23 May 2018 06:05:20 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4C4CF3F24A; Wed, 23 May 2018 06:05:20 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 2465A1AE5409; Wed, 23 May 2018 14:05:48 +0100 (BST) Date: Wed, 23 May 2018 14:05:48 +0100 From: Will Deacon To: Sodagudi Prasad Cc: keescook@chromium.org, luto@amacapital.net, wad@chromium.org, akpm@linux-foundation.org, riel@redhat.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, ebiggers@google.com, fweisbec@gmail.com, sherryy@android.com, vegard.nossum@oracle.com, cl@linux.com, aarcange@redhat.com, alexander.levin@verizon.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org Subject: Re: write_lock_irq(&tasklist_lock) Message-ID: <20180523130547.GF26965@arm.com> References: <0879f797135033e05e8e9166a3c85628@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0879f797135033e05e8e9166a3c85628@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prasad, On Tue, May 22, 2018 at 12:40:05PM -0700, Sodagudi Prasad wrote: > When following test is executed on 4.14.41 stable kernel, observed that one > of the core is waiting for tasklist_lock for long time with IRQs disabled. > ./stress-ng-64 --get 8 -t 3h --times --metrics-brief > > Every time when device is crashed, I observed that one the task stuck at > fork system call and waiting for tasklist_lock as writer with irq disabled. > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/kernel/fork.c?h=linux-4.14.y#n1843 Please use a newer kernel. We've addressed this in mainline by moving arm64 over to the qrwlock implementation which (after some other changes) guarantees forward progress for well-behaved readers and writers. To give an example from locktorture with 2 writers and 8 readers, after a few seconds I see: rwlock: Writes: Total: 6725 Max/Min: 0/0 Fail: 0 Reads: Total: 5103727 Max/Min: 0/0 Fail: 0 qrwlock: Writes: Total: 155284 Max/Min: 0/0 Fail: 0 Reads: Total: 767703 Max/Min: 0/0 Fail: 0 so the ratio is closer to ~6:1 rather than ~191:1 for this case. The total locking throughput has dropped, but that's expected for this type of lock where maximum throughput would be achieved by favouring readers. Will