From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA081C433ED for ; Thu, 8 Apr 2021 17:48:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4666F61103 for ; Thu, 8 Apr 2021 17:48:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4666F61103 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C3BB56B0036; Thu, 8 Apr 2021 13:48:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEC6F6B006E; Thu, 8 Apr 2021 13:48:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8C7E6B0071; Thu, 8 Apr 2021 13:48:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 8A6D66B0036 for ; Thu, 8 Apr 2021 13:48:08 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4E173A763 for ; Thu, 8 Apr 2021 17:48:08 +0000 (UTC) X-FDA: 78009933456.17.F5B3560 Received: from outbound-smtp57.blacknight.com (outbound-smtp57.blacknight.com [46.22.136.241]) by imf14.hostedemail.com (Postfix) with ESMTP id 86966C0007D7 for ; Thu, 8 Apr 2021 17:48:02 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp57.blacknight.com (Postfix) with ESMTPS id 60741FA7D7 for ; Thu, 8 Apr 2021 18:48:06 +0100 (IST) Received: (qmail 27078 invoked from network); 8 Apr 2021 17:48:06 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 8 Apr 2021 17:48:06 -0000 Date: Thu, 8 Apr 2021 18:48:04 +0100 From: Mel Gorman To: Peter Zijlstra Cc: Linux-MM , Linux-RT-Users , LKML , Chuck Lever , Jesper Dangaard Brouer , Matthew Wilcox , Thomas Gleixner , Ingo Molnar , Michal Hocko , Oscar Salvador Subject: Re: [PATCH 0/11 v2] Use local_lock for pcp protection and reduce stat overhead Message-ID: <20210408174804.GH3697@techsingularity.net> References: <20210407202423.16022-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 86966C0007D7 X-Stat-Signature: gru8w9ua6u1sgm1twn59xtcf869jiawh Received-SPF: none (techsingularity.net>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=outbound-smtp57.blacknight.com; client-ip=46.22.136.241 X-HE-DKIM-Result: none/none X-HE-Tag: 1617904082-124190 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Apr 08, 2021 at 12:56:01PM +0200, Peter Zijlstra wrote: > On Wed, Apr 07, 2021 at 09:24:12PM +0100, Mel Gorman wrote: > > Why local_lock? PREEMPT_RT considers the following sequence to be unsafe > > as documented in Documentation/locking/locktypes.rst > > > > local_irq_disable(); > > raw_spin_lock(&lock); > > Almost, the above is actually OK on RT. The problematic one is: > > local_irq_disable(); > spin_lock(&lock); > > That doesn't work on RT since spin_lock() turns into a PI-mutex which > then obviously explodes if it tries to block with IRQs disabled. > > And it so happens, that's exactly the one at hand. Ok, I completely messed up the leader because it was local_irq_disable() + spin_lock() that I was worried about. Once the series is complete, it is replated with local_lock_irq(&lock_lock) spin_lock(&lock); According to Documentation/locking/locktypes.rst, that should be safe. I'll rephrase the justification. -- Mel Gorman SUSE Labs