Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2470744imm; Thu, 27 Sep 2018 13:28:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63N4gBR4R/DS70k+fupxeOZS8pqsQdvtKEcfsTJCjZ41zfl6nwXna2OWrptvOJj9QfPFRjW X-Received: by 2002:a17:902:14d:: with SMTP id 71-v6mr12437543plb.146.1538080094811; Thu, 27 Sep 2018 13:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538080094; cv=none; d=google.com; s=arc-20160816; b=Mvndyu9/Uo5ZPBrF5srXm4ud/ezvOKlYZ6DN7WZeoDDif1QyxI1YUJKKDcev/WC4Gb 0auxuEiWZ8KNir8sTg3VYjH+K8h2YUYGPT1Os3cBuyt87FKtrmw2Vsg2+CScFIZjFe2G f3Q3Jz6TAI3tuD0hNgocYvmial/rt3A4xH6QUm6ThYW5VxBbnjpZ0gv4U2iguzEkRDGp 5hQzdgFDoPiXAm0eOrpbuPWetpeTImdposdKg5pyPFfLlNZM5LVpPMJs1ti9Da+MP5pD fbMl3D6Mh2ivSZhbnhQmQpdhJulW9w/LnWHo5xRIkvo19x2H90355QHO5o5Eh6Jk1Ec5 UBow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:user-agent:cc:to:subject:from:date:dkim-signature; bh=gIneU/dzQhuezwAjGtFUv/uuI9eLjn06Oz2Tg7/K6eU=; b=VwhvpSM0QgQ+a90iizar2MaEbC+hQkC2snY+r+3+ZbCqBmOPdE8GyBjXmNSE84Iss+ Rf/N5zFz1MXlHgjKqI52lBNvsBpqJ47DQPG2H8PhugIOAuuXfPJhc0GbtecBU3a3Ivqy iS9hCOpZ2upcx+kGr/JjJipyU4wPgfn0fJSKEvDOS2kUvQocu1PgOp9A/gq/Wm6TguCw 9kWyVQPmM8i3YO23VDecbuvTr8Tj3LXsH74jbnUZpjicpwFmFo4gfV8bUgvt3TExawGy vEJHQFf3rfga8PJq09CFRbQJcaV1lDgakbnrVOZ3c92qz72GHkFuMf3wgXHktQWd4nl1 GP/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b=n5OmVUnQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si2901638pln.78.2018.09.27.13.27.58; Thu, 27 Sep 2018 13:28:14 -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=@yahoo.ca header.s=s2048 header.b=n5OmVUnQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbeI1Cr0 (ORCPT + 99 others); Thu, 27 Sep 2018 22:47:26 -0400 Received: from sonic316-21.consmr.mail.ne1.yahoo.com ([66.163.187.147]:34893 "EHLO sonic316-21.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727389AbeI1Cr0 (ORCPT ); Thu, 27 Sep 2018 22:47:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1538080041; bh=gIneU/dzQhuezwAjGtFUv/uuI9eLjn06Oz2Tg7/K6eU=; h=Date:From:Subject:To:Cc:From:Subject; b=n5OmVUnQblo/fs8jKd0eInaWjruIXOSWVi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r5WUV.oiVs.edZwOc5bT3ZtTVbMZppgkleI.kfE8M.7i10hOEciuKZL28Uzbk7SrPHcmPdB1zCU oqwHcGgVygMEw_2OnPniYhLakTASYc4aQJ9vntEaNW_Ww5eBeuipimMS4Da9QuuFj4hECWF4Z4m. QCNd7ta53T.WaEYapxr4ZsV975WA1fhs69fjyu5Q0yN4rXrlpgf2b.kNSIiXl_J7GLcMJ3roYwT3 RD5y8QLSh8pIjHDps1aNIF0_8iO5TU8qvCiT5GZ_Mpdi9drHSYUzB6nOKxLcVyXds4Q-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Thu, 27 Sep 2018 20:27:21 +0000 Received: from pink.alxu.ca (EHLO localhost) ([198.98.62.56]) by smtp418.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID c87d8e9a43fcfc4d244e7731ae0e3424; Thu, 27 Sep 2018 20:27:18 +0000 (UTC) Date: Thu, 27 Sep 2018 16:27:12 -0400 From: "Alex Xu (Hello71)" Subject: [PATCH] mm: fix z3fold warnings on CONFIG_SMP=n To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: ddstreet@ieee.org User-Agent: astroid/0.13.0 (https://github.com/astroidmail/astroid) Message-Id: <1538079759.qxp8zh3nwh.astroid@alex-archsus.none> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Spinlocks are always lockable on UP systems, even if they were just locked. Cc: Dan Streetman Signed-off-by: Alex Xu (Hello71) --- mm/z3fold.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 4b366d181..4e6ad2de4 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -202,6 +202,13 @@ static inline void z3fold_page_lock(struct z3fold_head= er *zhdr) spin_lock(&zhdr->page_lock); } =20 +static inline void z3fold_page_ensure_locked(struct z3fold_header *zhdr) +{ +#ifdef CONFIG_SMP + WARN_ON(z3fold_page_trylock(zhdr)); +#endif +} + /* Try to lock a z3fold page */ static inline int z3fold_page_trylock(struct z3fold_header *zhdr) { @@ -277,7 +284,7 @@ static void release_z3fold_page_locked(struct kref *ref= ) { struct z3fold_header *zhdr =3D container_of(ref, struct z3fold_header, refcount); - WARN_ON(z3fold_page_trylock(zhdr)); + z3fold_page_ensure_locked(zhdr); __release_z3fold_page(zhdr, true); } =20 @@ -289,7 +296,7 @@ static void release_z3fold_page_locked_list(struct kref= *ref) list_del_init(&zhdr->buddy); spin_unlock(&zhdr->pool->lock); =20 - WARN_ON(z3fold_page_trylock(zhdr)); + z3fold_page_ensure_locked(zhdr); __release_z3fold_page(zhdr, true); } =20 @@ -403,7 +410,7 @@ static void do_compact_page(struct z3fold_header *zhdr,= bool locked) =20 page =3D virt_to_page(zhdr); if (locked) - WARN_ON(z3fold_page_trylock(zhdr)); + z3fold_page_ensure_locked(zhdr); else z3fold_page_lock(zhdr); if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &page->private))) { --=20 2.19.0 =