From patchwork Sun Nov 11 20:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 10677789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF9CD1759 for ; Sun, 11 Nov 2018 20:04:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9440929992 for ; Sun, 11 Nov 2018 20:04:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 866B529AC7; Sun, 11 Nov 2018 20:04:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1A7429992 for ; Sun, 11 Nov 2018 20:04:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FA996B0008; Sun, 11 Nov 2018 15:04:56 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8A83A6B000A; Sun, 11 Nov 2018 15:04:56 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 796EE6B000C; Sun, 11 Nov 2018 15:04:56 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 367F36B0008 for ; Sun, 11 Nov 2018 15:04:56 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id b4-v6so2818157plb.3 for ; Sun, 11 Nov 2018 12:04:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=tcJubUvpGCS552YFSYW0bTskAWzrqVZR3KNLPaPItF0=; b=X3y2N46PlXHs6r/vstOqWRvnx8Dy/RJ5mJHpxoQ4/eSosWHZ9qpEjJKFSeySdiqJCh zgeulPqYQz1pVHKb09HEF3SXxAl4Qs/1QR9v4+mtwvXRjFEmmcYT9OPxM234slLjXQH0 sVrSmb62d9+UfjrOFfizomlzbKFlYUSKo27qXzUKQDyhL4JnNmGD8sdwV0DZxQi7lcQY sN7VpopA1XHNaJ4av7/MCJ8K26oqDQdfGsCifxznLIuzyZ9Rw0KePQV4knVnJCXUC8G7 UrbMWHfpWJ/sYpAVz9IgAj8DPuYikLjqGQEMNWlh6v9LZZINYzY5SIgktZKS42LkeV66 FUPA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of paulmck@linux.vnet.ibm.com) smtp.mailfrom=paulmck@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gI6YZVt+uLYk3uWHR9/Y2nRSKvWHaXtHZf9K87YdPfajAUa3P4n qCnDU/jnk1caHi21Rpw3TfWLxez3hHdAEhTzh0G7H8/NwdkiXygNp9LAVy3hqXEtrpWptTHVCjv aUWkuC2Gf4qJrrGz9zAKy3mU8qzbHnoXWdg/2XG6I1t5J7EvEBcu0gJ5Qaqor79A= X-Received: by 2002:a63:4c6:: with SMTP id 189mr15153805pge.391.1541966695865; Sun, 11 Nov 2018 12:04:55 -0800 (PST) X-Google-Smtp-Source: AJdET5fKREG8HdQ+2jQtLoYNWdrNcR4fQfdI9g/gmrydtUDCUqI5CAKxmZk1enX7Ebh2GYqRw8Mq X-Received: by 2002:a63:4c6:: with SMTP id 189mr15153742pge.391.1541966694822; Sun, 11 Nov 2018 12:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966694; cv=none; d=google.com; s=arc-20160816; b=Wh38MLS4pnYEJJqKtjVv0ONROse1rNE/2+sWS+UnE+a3+hzjSWztgHg1gSzpWKrjka y5kj/hMGHJLYlvjxiTd/NeU20lYY0FnPtIF+eAvWYsY0+BZsfmoVxa/JHqS53/84xr9Y Zmb9RQZXkzxktDyb/f74WmLFEUsioedTYKVUdvpfIlCylqE81rgjGvfEkqsPRLGbv5fJ zoOYzG/XO6Y9U27BowSWDK0Cbj/3J2ae8WrmDdzL9Um2A/qCQ/epxIiAPkVhFcK0JZiY H9TLtSyJ7qeaiDTNeeIIBWrKLJ2mp9f4GwVAgRhJzNI+TMunQ8yz9hEGIWAS1+biYBYY GjXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=tcJubUvpGCS552YFSYW0bTskAWzrqVZR3KNLPaPItF0=; b=EsHiwbvjUZVK1cHhczo+VBJ8rylS8xgrUjwNrrfvg3944/QwYOj3M7Vx6KNMOQaWr7 tqU+qP4CYRZMHGd7I691qN/+ZB199eb81qJMT+VDnF/IrqeKIOJPbPAJD+sQGvMwYbuF fxb+5WvY3zwEoC/tolrj2mpeHNlbBJgsW3Wtjz1N3r3f3aek7YN+PNv4r77N+LnnvDaK 8/L+jNKH/9pbsXeNOP/UUkPweLzaNJi90+SpESGcJdPMFhmsjWqkFsEZ676rSAKPk6qS Cgmwt9XHhLD0WlX+h9Npga2icnZ8p8+mecPDwMI/dKBGQqdocMYIMh0oV0AppXDAA0E5 YZMA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of paulmck@linux.vnet.ibm.com) smtp.mailfrom=paulmck@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id i1si4393866pgs.417.2018.11.11.12.04.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Nov 2018 12:04:54 -0800 (PST) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of paulmck@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of paulmck@linux.vnet.ibm.com) smtp.mailfrom=paulmck@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wABJwuF7002470 for ; Sun, 11 Nov 2018 15:04:54 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2npdcu293c-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 11 Nov 2018 15:04:54 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 11 Nov 2018 20:04:52 -0000 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 11 Nov 2018 20:04:45 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wABK4ijG33358042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 11 Nov 2018 20:04:44 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 39CC5B2066; Sun, 11 Nov 2018 20:04:44 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ECFF7B205F; Sun, 11 Nov 2018 20:04:43 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.207.24]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Sun, 11 Nov 2018 20:04:43 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id B84BD16C5D9C; Sun, 11 Nov 2018 12:04:44 -0800 (PST) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, Lance Roy , "Kirill A. Shutemov" , Yang Shi , Matthew Wilcox , Mel Gorman , Jan Kara , Shakeel Butt , linux-mm@kvack.org, "Paul E . McKenney" Subject: [PATCH tip/core/rcu 6/7] mm: Replace spin_is_locked() with lockdep Date: Sun, 11 Nov 2018 12:04:42 -0800 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181111200421.GA10551@linux.ibm.com> References: <20181111200421.GA10551@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18111120-2213-0000-0000-00000315A951 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010028; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01116026; UDB=6.00578737; IPR=6.00896126; MB=3.00024114; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-11 20:04:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111120-2214-0000-0000-00005C38741F Message-Id: <20181111200443.10772-6-paulmck@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-11_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=577 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811110191 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: X-Virus-Scanned: ClamAV using ClamSMTP From: Lance Roy lockdep_assert_held() is better suited to checking locking requirements, since it only checks if the current thread holds the lock regardless of whether someone else does. This is also a step towards possibly removing spin_is_locked(). Signed-off-by: Lance Roy Cc: Andrew Morton Cc: "Kirill A. Shutemov" Cc: Yang Shi Cc: Matthew Wilcox Cc: Mel Gorman Acked-by: Vlastimil Babka Cc: Jan Kara Cc: Shakeel Butt Cc: Signed-off-by: Paul E. McKenney --- mm/khugepaged.c | 4 ++-- mm/swap.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index c13625c1ad5e..7b86600a47c9 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1225,7 +1225,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot) { struct mm_struct *mm = mm_slot->mm; - VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock)); + lockdep_assert_held(&khugepaged_mm_lock); if (khugepaged_test_exit(mm)) { /* free mm_slot */ @@ -1631,7 +1631,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, int progress = 0; VM_BUG_ON(!pages); - VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock)); + lockdep_assert_held(&khugepaged_mm_lock); if (khugepaged_scan.mm_slot) mm_slot = khugepaged_scan.mm_slot; diff --git a/mm/swap.c b/mm/swap.c index aa483719922e..5d786019eab9 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -823,8 +823,7 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, VM_BUG_ON_PAGE(!PageHead(page), page); VM_BUG_ON_PAGE(PageCompound(page_tail), page); VM_BUG_ON_PAGE(PageLRU(page_tail), page); - VM_BUG_ON(NR_CPUS != 1 && - !spin_is_locked(&lruvec_pgdat(lruvec)->lru_lock)); + lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); if (!list) SetPageLRU(page_tail);