Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp421342ybi; Tue, 2 Jul 2019 22:56:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqh6mNQOkm3KJLVeX3id/XnmXT+0AmbwlbIKiuJ9LdncmngOoTc4HG9xpRGCRum7baTCDo X-Received: by 2002:a65:4347:: with SMTP id k7mr35439622pgq.253.1562133414044; Tue, 02 Jul 2019 22:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562133414; cv=none; d=google.com; s=arc-20160816; b=tzWrf2inR+v4jpZFxfHzbE9MguNLzxiohmOXvAQj59oaJMzuLAh6z+kVbAcBiuWa6c 6xL041JRkRhhrxEEaVQeGMafo6PL5oOCirAsj7AXONjIkNAfe///A7kQlk9TgfW4wr4z uPoPqoeygXh8DnxdUuz8sccDmzD1ziD9mQ2i1UdSFrhitfDFerG7EOErJKuGIggUdQGm HvI63zwd0XVfRmRKmbpIhq6m5JyPg/X+MgxKnbMncEiO1HSAxJouxFcdlQOH7vhwniaN adA7IVBgOJUyvq2spxVIyYvj5eoE6K3XZQ8B3jzjSxGuGHJ1Q5wPfO7CCujdWUXjm5+o K8ag== 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=fodI9RBCNqef8mpe31lNAJ/C8aPx3qCPQdaIULFPQEE=; b=iofmaiN7myCexqAG8QW5y50/DThIqa/1glR/YKeSi0bjYn95qCeufyxEfoANej1O4Z pYvNMQyXY5R6i3GV+OLnVl+Lty4q0V5gOGYBll/OBRhLNztKWOTMiHsb+w28eHPG6Bwv KwVZbt11g9/OaNzkUtsLVlKTIujvppcv0bJsoxaugy5EBq8wnPEttKOiqI2G5SGbL3UF a8jtyoryG5GRzuFxZQwM359NjhvsopLxzWLrQ6wS5o9w+iawyUOxMzFrrV4H8l7MXFj+ f8LsTLJ3pWE2eiSmPV2a1ONvhNoB7fnWHlSzyVCUNOiF/LCLFcx+L2tw6+43a3iMVSRP SRww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AHbczLFR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si1022785pjq.108.2019.07.02.22.56.38; Tue, 02 Jul 2019 22:56:54 -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=@gmail.com header.s=20161025 header.b=AHbczLFR; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbfGCFyd (ORCPT + 99 others); Wed, 3 Jul 2019 01:54:33 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45469 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725927AbfGCFyc (ORCPT ); Wed, 3 Jul 2019 01:54:32 -0400 Received: by mail-lj1-f193.google.com with SMTP id m23so971735lje.12 for ; Tue, 02 Jul 2019 22:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fodI9RBCNqef8mpe31lNAJ/C8aPx3qCPQdaIULFPQEE=; b=AHbczLFRfqjuasmjmf30Hp49qfV0kAllz4rzpXWdPTIk4/ZlCNK3n/2EkaNRwYdgbz X+cN1RcUD9z36Tgkn2j1xJtIDZYR8Fht7jHZ/tMm4ZcIxsyU60SOhe/boS6RwAnsXUJo X5J8ToDtvEIH/qsrWau/X0ci+4WSMh89blfdBk66hBhOxobWrJ2qD8o9ZcEQGbqHbRBp x98npKojErQCAkBd65rFWVqeJfetB9Eo8/8KJ8O3sa4sy2+ZAFvp8qNadLIbuyNccfhf cp+k5AgU1VUR+Tk6JLRN/QSawNvIrPCeZdT/pV2Yk23NdGrbnxVXdeUMAsgH+KKqWd8L 5NUQ== 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=fodI9RBCNqef8mpe31lNAJ/C8aPx3qCPQdaIULFPQEE=; b=mt1Bmxr7ZybQ7vpwmOL9vcH1EyydBRnUsId0O+hAbBbN/wGTxBde52mQy0QaY55Da8 B+wXGqroSkGDc1KMFK6z2UgO7sIdLy+HabtIcgwli6kWhHePiKEWs7oayiDztjNMFJpn txRM2+2pTLY2L7f40dgagHtjZQ5Kv95mhIxIOXbh2984ZestZZWuyDIwMErYhM6NJOfF HZtLwBl8F9EQtORVb62NpWr75FXMMwRGeohR2yBgF068huuxsKzd8YhUbd9Z+mkjNGYV jia0cJ49Grdgv6ZiY3hF0p/yFUHq8MLB/WzGms1h7a6BRakS78IjPQ3KsNVwnK/x33Ei sAKA== X-Gm-Message-State: APjAAAXKrNQHp3mkHimcPF4AjoYudfn9cTqmsT7Ly8D2q745fb/p73qG t7orIaPNtQpPtUF38SNtEwT8M6IEMPdZwmV8RQ4= X-Received: by 2002:a2e:80c8:: with SMTP id r8mr5330522ljg.168.1562133270780; Tue, 02 Jul 2019 22:54:30 -0700 (PDT) MIME-Version: 1.0 References: <20190702005122.41036-1-henryburns@google.com> <20190702141930.e31bf1c07a77514d976ef6e2@linux-foundation.org> <20190702152409.21c6c3787d125d61fb47840a@linux-foundation.org> In-Reply-To: <20190702152409.21c6c3787d125d61fb47840a@linux-foundation.org> From: Vitaly Wool Date: Wed, 3 Jul 2019 07:53:32 +0200 Message-ID: Subject: Re: [PATCH v2] mm/z3fold.c: Lock z3fold page before __SetPageMovable() To: Andrew Morton Cc: Henry Burns , Shakeel Butt , Vitaly Vul , Mike Rapoport , Xidong Wang , Jonathan Adams , Linux MM , LKML 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 Wed, Jul 3, 2019 at 12:24 AM Andrew Morton wrote: > > On Tue, 2 Jul 2019 15:17:47 -0700 Henry Burns wrote: > > > > > > > + if (can_sleep) { > > > > > > + lock_page(page); > > > > > > + __SetPageMovable(page, pool->inode->i_mapping); > > > > > > + unlock_page(page); > > > > > > + } else { > > > > > > + if (!WARN_ON(!trylock_page(page))) { > > > > > > + __SetPageMovable(page, pool->inode->i_mapping); > > > > > > + unlock_page(page); > > > > > > + } else { > > > > > > + pr_err("Newly allocated z3fold page is locked\n"); > > > > > > + WARN_ON(1); > > The WARN_ON will have already warned in this case. > > But the whole idea of warning in this case may be undesirable. We KNOW > that the warning will sometimes trigger (yes?). So what's the point in > scaring users? Well, normally a newly allocated page that we own should not be locked by someone else so this is worth a warning IMO. With that said, the else branch here appears to be redundant. ~Vitaly