Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2483811imm; Thu, 27 Sep 2018 13:43:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63s8PyHGOo2kzrxFznJ7X+nYSSyIU44URMqL252yiRyGTN/iNqlSZCt5BpwcjdCi0qZi68T X-Received: by 2002:a63:4343:: with SMTP id q64-v6mr11840302pga.276.1538080994250; Thu, 27 Sep 2018 13:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538080994; cv=none; d=google.com; s=arc-20160816; b=OondGEiyND6tnj4Z9qbIMjZDQ0fL4KlacFUV3q7fevidC7d50TJ7HlK4uPkT+f4ge8 5hlzze7h0foslKJ4JIHheFbCK4QcgNlUxAmmnJxBAgb83NPc3rP+lPSwZoUYVKIvqqj8 YAKMJKboQ7RYXLvOif++zm/jB0nO1JjQqMi121QQXWowOppLxJTbm3n+IwvA3tZnxqJN OH8VxJy9cgabbDvXsDBNtRoeMO7viWw0ycFsMP3YHugrm6uujJ9V9LHbralRoZM1oW91 1TekOMmyPoc+5fUgS5WRqc8p5lB/2Z1R5r5FTYnaUrypqukfG60O5Xzm38qmYItEWKCJ ot6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gSb6lgbkEKRFaGdmBWqMU23xZBo4EVXhsGFHPgqXa7w=; b=JGrAZ1/MgI2hI4PrckOBqjW9WikCMJpsU0Q/oiYNm+pjAYsl1Aq+2sSgDSR/l55KEB 07Y7iN96QThv47xIMCkw1JdgBcCjepUi7Un/A/fiXi8wX3MuGmsoyZpo6+mVQwjTeXkJ F3w1dYhkSvKXAuO+0MsDXsLJ4FMLiB6FrRCToAAb42ijaxfyp7NlZtrakOr1vBVEYJ8V YEiCws0h2a0WKzP2grTjb1bik60g/pnTfQV74VXdEER4YNwTWXV/2Xe/VlhTMiEusbyc 5U4sj0bG/70WVMop6zFobUQKKPjH9g6swZYSOFeiLZDFuVcdkx0DgffH3zkr+6tVu0ES 0Igg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=faTswss9; 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=NONE sp=NONE dis=NONE) header.from=ieee.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14-v6si2723041pgc.179.2018.09.27.13.42.57; Thu, 27 Sep 2018 13:43: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=@ieee.org header.s=google header.b=faTswss9; 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=NONE sp=NONE dis=NONE) header.from=ieee.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728372AbeI1DCG (ORCPT + 99 others); Thu, 27 Sep 2018 23:02:06 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:55127 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbeI1DCG (ORCPT ); Thu, 27 Sep 2018 23:02:06 -0400 Received: by mail-it1-f196.google.com with SMTP id f14-v6so172098ita.4 for ; Thu, 27 Sep 2018 13:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gSb6lgbkEKRFaGdmBWqMU23xZBo4EVXhsGFHPgqXa7w=; b=faTswss9v3nkOZdHJx69Nru0N57Ra6IL40Ozxkjhrg0KUBRDuK4GNHYnWF/tUYWQw8 Boh6Hwk7MCuQ/tW7R3rQw+sHRKntC9JmHWiFioSVYyoaf5SEkCJYnMVyO+8D4KXGJo8F +fGjWRDGNMuiqw6lqDX5x9a+Ni14308diT8yA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gSb6lgbkEKRFaGdmBWqMU23xZBo4EVXhsGFHPgqXa7w=; b=plGLnARnD3U8Uah8oEJTxEeCxKAKAwcyFtlyiYW8fTObVVSFkehvHvC9WdlIkE3BNa iZeJVLGf/rSO70rzV6AcDrtyxMRclkac4dQChOlJT+XLR8bLo1Swgp/fiRnhEc1im6AH Pk3tgOeAihVPRBUINdaIjIjjQs8jwnncES+ayPh7osTm10B/cjHV3zGanrtGRXsSJzfE 2MP1Zm73dBdqInK86h+MOmBhbDqtQ3KpLi3KdlfEUnFQCHtjn8Y5Hgbiwz88I/P8mp6T WliHBYhYflVKvRga6ws1mk0acch7qKl2MhusZibIRKnGHcPDAEwavOn3ELTEHXgzoatY wPKw== X-Gm-Message-State: ABuFfohNv0caIJHyJHu7CdcKIV58HlRuvXpgvmT/ITbrku6xaMcQlyKh vt/N+L58VoctfvSDncTfnhIMCRNrBtLr8Tdzg0UiRg== X-Received: by 2002:a24:6e87:: with SMTP id w129-v6mr228244itc.49.1538080918370; Thu, 27 Sep 2018 13:41:58 -0700 (PDT) MIME-Version: 1.0 References: <1538079759.qxp8zh3nwh.astroid@alex-archsus.none> In-Reply-To: <1538079759.qxp8zh3nwh.astroid@alex-archsus.none> From: Dan Streetman Date: Thu, 27 Sep 2018 16:41:21 -0400 Message-ID: Subject: Re: [PATCH] mm: fix z3fold warnings on CONFIG_SMP=n To: alex_y_xu@yahoo.ca Cc: Linux-MM , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 4:27 PM Alex Xu (Hello71) wrote: > > Spinlocks are always lockable on UP systems, even if they were just > locked. i think it would be much better to just use either assert_spin_locked() or just spin_is_locked(), instead of an #ifdef. > > 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))) { > -- > 2.19.0 >