From patchwork Thu Sep 27 20:27:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex Xu (Hello71)" X-Patchwork-Id: 10618533 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 7E4E1112B for ; Thu, 27 Sep 2018 20:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 714FB2B520 for ; Thu, 27 Sep 2018 20:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 652922B532; Thu, 27 Sep 2018 20:27:25 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 595B72B520 for ; Thu, 27 Sep 2018 20:27:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AC6F8E0002; Thu, 27 Sep 2018 16:27:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4333F8E0001; Thu, 27 Sep 2018 16:27:23 -0400 (EDT) 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 2D3338E0002; Thu, 27 Sep 2018 16:27:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by kanga.kvack.org (Postfix) with ESMTP id 02E738E0001 for ; Thu, 27 Sep 2018 16:27:23 -0400 (EDT) Received: by mail-io1-f72.google.com with SMTP id g133-v6so4160870ioa.12 for ; Thu, 27 Sep 2018 13:27:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:subject:to:cc :user-agent:message-id:mime-version:content-transfer-encoding; bh=gIneU/dzQhuezwAjGtFUv/uuI9eLjn06Oz2Tg7/K6eU=; b=Tl1mPj+IB1GMSPtNrP/OmI5BsibzRUfYoE7mCMRyaczoh+VRe+hfWVqphGNtelJ6uH AyHCrikIUPy1/puvIYAlD6A8g8tw1YMJ30GGipmWlgppS+nORCZQE0Is/3XZBIbuaSvc R6PCjq7r4+5/LVAd9LFygWmXC10HrO3Mz5u5kSLUQgCdZerJrCvLVvpTvCQG3Zn22iOv YwcNmv3mGB6a1N+yTtnsqOpukMMBCfqv+of0GCJ3ePAZwOMuP2owjDA9w0o5eL+RlZxd tEzZO7raWq2LGbAyUb1RENriXnQTeG0jwhXdr3UpYF28rAweXo5Sc2zQI8iGlJNUp1L6 6rKg== X-Gm-Message-State: ABuFfoiwNyvwxK3y+BH3A86CQ497gGomYGf1cKGntSgUb4z77dOFHkh1 plookuargO9zxWspzIb0wVZXtaVFSPAwf2nKfBRz+3QtKvUVGYplZrZnMc5cA2R/rUs03IrKeiv GdmzRsE7xu9je1h77jMu3LfhhHn37q4PShg9SO2ZUOPwmObyAmyImtl7uSI9L6xC7Lw== X-Received: by 2002:a6b:f815:: with SMTP id o21-v6mr10482141ioh.203.1538080042653; Thu, 27 Sep 2018 13:27:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV61CVAo0SIuXuHWfCkdMhYtlIAtgMrpoqs/4pnzZM5uE+OAZnttRMSh86/UA1Gy7ayCxRIDJ X-Received: by 2002:a6b:f815:: with SMTP id o21-v6mr10482107ioh.203.1538080041553; Thu, 27 Sep 2018 13:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538080041; cv=none; d=google.com; s=arc-20160816; b=jXgwAlv0YzOPv2O2lGRCWHZn33LqYFmkxOYKfUQF2bWnZWwWFGhCtQDiRmL15fUvnv PRQpdF+Dd7x0ImMchgrPE3KFxrSA7kvWAZ04LVtoBqjJYVWnG0+FLH4Ak79gvz7ARSJc Mqdugz3MRDdKHaa4icjx780lTk9VBgCcFpFZNJRmll0bAfRX5Q0qXjM8jX4lUh/Yl10j e0x7d9GAZ36+xN4SJ45oyf0GPxIrLbDfqXHdLBZS6JZZS8+uuQ/LhhxvvmwDjsbdDeBs C66Vb+dpgsOi39Gs1+wWvzDCDN2aZ+tm/D5h/rNSACWeb+Og9Cijqnk5jadAUUmO1d+P L6Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:user-agent:cc:to :subject:from:date:dkim-signature; bh=gIneU/dzQhuezwAjGtFUv/uuI9eLjn06Oz2Tg7/K6eU=; b=jcg+lu7DlVFGnFFyu3+xG7LmjBeq/mZqaqUm4Fe0QDFBiL124j9v/0YnLsrrlKH7cd e3PQvzbb03e1EZryNRtQiyNkZN60CReuuNy72pMdAKTJ0f4BuVGBgn25Tf9XBjMgiwaE ti+m0fQLXtBcZQjF2nIBYR9LY/C11N60rAYbjgSnm1rdGqnaZL0Lqr6GQKyFA2WTe7Qr uRMSI12KN4KwfqPvsqP/kmFYSWWhhupVpB1HoUY4Iz+RZ5I+U01rr+X/bhTKx5/o96xq g83cGmlCMgXJL6FTVjAixFzgiTj9/UhiMFAp/Gp54VYkuY9TAkESUAAGmXLoECtfOVhO E1Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b=n5OmVUnQ; spf=pass (google.com: domain of alex_y_xu@yahoo.ca designates 66.163.187.147 as permitted sender) smtp.mailfrom=alex_y_xu@yahoo.ca; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Received: from sonic316-21.consmr.mail.ne1.yahoo.com (sonic316-21.consmr.mail.ne1.yahoo.com. [66.163.187.147]) by mx.google.com with ESMTPS id u26-v6si1632830iog.121.2018.09.27.13.27.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 13:27:21 -0700 (PDT) Received-SPF: pass (google.com: domain of alex_y_xu@yahoo.ca designates 66.163.187.147 as permitted sender) client-ip=66.163.187.147; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b=n5OmVUnQ; spf=pass (google.com: domain of alex_y_xu@yahoo.ca designates 66.163.187.147 as permitted sender) smtp.mailfrom=alex_y_xu@yahoo.ca; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca 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/fs8jKd0eInaWjruIXOSWViybKFaMPyQaD0AcIiUrUlMv7FwOSKiwgezRA56hWFtjNLvOo9NccUSPpU0g3Y5J4qe95d9o8AO0n0bA+4fUZLXxhntGV7+C90juHPI2dghIAX0OhTCn+hFXzHjQc7Y+B0Nwe48E02tIRXEfqWqv7XFEn4JzVj7l1sBSXdc/Bi5Po5KyP0Wj17btWfydPbkVZ3LJSdiuJZDkfuj+nI0JAb/qcLUjo2aFZ8J4O9fkFObYQXNEhvdHr4XSajxfRlJ8hl4k8CFQ5FBFTN5p+OAQCT70YxcIIf0IhxerlaFZbm1c/T8CpjYFXw== X-YMail-OSG: t0_gF3sVM1n9co6J8PEqzeWVxjLIkOV3t0g0eeAlIeOuKNx6zvNjDOf7062mUlW GCUy7wRZn4eTnnrCJ.G_zwUADQSfmpWu9V44aRESLZy4v05YUaBHvEnbSS9A0AKLFVpf3CLcUCoY k4f7j7Fso0JQPrva8Tz81xfxDpeeFUvtpJC0GlZxwUH32_8pyT1Fvd2ioDMIOOyLjN0ECncvLPsJ Pc9vRqNloqX2Fjluc0CBQ8tFn0uA1pkc.so9Df8GnxboqymA0lT_0inZZIANGP.QQg3uv15QG3TX lisdZuDnFqcxhn.54dlGNzGid.10oYkNYMlynxT5FLGayES3n2RUqLkmeBn_z91aF.FORFDBDnpY TNlbc6vIATHQLJgv28ZCK6jSFCgaIf7p5osNHuAQwJ.ijWrjudHeTcL2_ridiwIy3dEt_kX3pHvh Rga.2A3WeeehXjsneDY6WjkiXq7xA5mhnrwVrR5oVMjp.QUgRv1UFrkDtG0hRUPGCHKlPNa1E3EL XGiJ3cIRhXrpMy2L30vTpr1xqwntGgmJvmp0iHVfd1IFfBH9jhcFFayWuecnG45iL_efTwOJKZiB ofu4C_HICMHLFxkicLdTIIOh1qPuKCsd3VvE9weFzg07okjtdfOMy0hVh4f6v9h5CncTtfZ8A7c_ CY00PsRxflFfVQRguR8Tq0NXoH_6WKjfwhuZsNSMLfevi2Ic5n7ZEqjw46JYQBpiMnV_auJ4hJQ2 Kr5WUV.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 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 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_header *zhdr) spin_lock(&zhdr->page_lock); } +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 = container_of(ref, struct z3fold_header, refcount); - WARN_ON(z3fold_page_trylock(zhdr)); + z3fold_page_ensure_locked(zhdr); __release_z3fold_page(zhdr, true); } @@ -289,7 +296,7 @@ static void release_z3fold_page_locked_list(struct kref *ref) list_del_init(&zhdr->buddy); spin_unlock(&zhdr->pool->lock); - WARN_ON(z3fold_page_trylock(zhdr)); + z3fold_page_ensure_locked(zhdr); __release_z3fold_page(zhdr, true); } @@ -403,7 +410,7 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) page = 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))) {