From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72021C43334 for ; Mon, 20 Jun 2022 01:30:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C01526B0072; Sun, 19 Jun 2022 21:30:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B897A6B0073; Sun, 19 Jun 2022 21:30:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A03BE6B0074; Sun, 19 Jun 2022 21:30:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8A6F06B0072 for ; Sun, 19 Jun 2022 21:30:36 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4FCBA602FF for ; Mon, 20 Jun 2022 01:30:36 +0000 (UTC) X-FDA: 79596884472.27.B0FB757 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 690F9C008A for ; Mon, 20 Jun 2022 01:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655688634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m84C8oG+oFGyQ0i+A2o8bEJV9tjqcgrBl3QurQb4ooo=; b=gVJlrrN50X/nuUrb25r+d57jCIpSW84xM5IoEHSzQKKmyHVic+fczj1G72vUvTE/8hyKE+ J7bwGP76s78eBVhlroN+hmu9p5PSOSkL3Jhksf/mQhltKV7OINA/rHNBrRI6xA1BwZ7PvY yfe5qj1tjX4a4Q9VB3fAaLgfGjBUjLo= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-41-OTZhF_6qNVCEWuoiqVEaPA-1; Sun, 19 Jun 2022 21:30:33 -0400 X-MC-Unique: OTZhF_6qNVCEWuoiqVEaPA-1 Received: by mail-pg1-f200.google.com with SMTP id 23-20020a630317000000b0040c8f928adcso2253606pgd.5 for ; Sun, 19 Jun 2022 18:30:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=m84C8oG+oFGyQ0i+A2o8bEJV9tjqcgrBl3QurQb4ooo=; b=najLKqPERN9QvV2QHYxJq0OuBf4vLzt03YTxmZwTnG3ZRi0Au3ASWs+VybXC5K7DW+ geepTHpg/7XzkJRDBW4W7py3vsfEbs+K6F3wVdyaAzSQ2ZAWhzd5m73hbfyqebts/IpC 8OWnIpHApIYLr4tulpsIPmtQTJ+23jEy3KGmVPMeRpjOYAhM/4Qbrwea5CBqsX/0TUqO C+b34CRVGUsAn5O7oBCNR/61ftmk4P1BCiGxwAnZxej7WDHeqW9VJBjBo8YUvE6SNS52 RjW1+zbG9Mkbrvu/Sycqz67ua7r+HtmfVtGUk8gr1zFbeFKuIOV5J8ZH6iTtA/v+RHSS WxjQ== X-Gm-Message-State: AJIora8JqnIPduALUAaFobBI8QKSC+FrYpWredn2l4tyMdwrjdUhQi2h aPbEH/BAaAYMK05dXdTRFytt8RJiNXyJzB4iAqFGBFHHAyQjJ/2VJATJVNbwGbnR6IrtcR9SIqn O/AGF6NAubSd8f+PCeM71Vzzl7nBcUQFVSVJmnhLjMCewGp2IFx/eOsiCaeV7 X-Received: by 2002:a63:6ec3:0:b0:40c:450f:2f83 with SMTP id j186-20020a636ec3000000b0040c450f2f83mr15126077pgc.220.1655688632431; Sun, 19 Jun 2022 18:30:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v0Zqp5eQp+eTkibB14bRc7BTuzOIbNFEFvRZPn1cuuTDGjY1baAwtXtghfbI6xSFV7JYKQSw== X-Received: by 2002:a63:6ec3:0:b0:40c:450f:2f83 with SMTP id j186-20020a636ec3000000b0040c450f2f83mr15126040pgc.220.1655688631953; Sun, 19 Jun 2022 18:30:31 -0700 (PDT) Received: from [10.72.12.43] ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id p11-20020a170902bd0b00b00162496617b9sm7287770pls.286.2022.06.19.18.30.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Jun 2022 18:30:31 -0700 (PDT) Subject: Re: [PATCH] ceph: switch back to testing for NULL folio->private in ceph_dirty_folio To: Matthew Wilcox Cc: Jeff Layton , idryomov@gmail.com, ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20220610154013.68259-1-jlayton@kernel.org> <6189bdb3-6bfa-b85a-8df5-0fe94d7a962a@redhat.com> From: Xiubo Li Message-ID: <63d6a1eb-44a5-eef9-2d28-acd172d87c2d@redhat.com> Date: Mon, 20 Jun 2022 09:30:23 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655688636; a=rsa-sha256; cv=none; b=VRRpmpVcp1R6tYaWRl9qfqornihU10H8RTHu0pzM89xRUJYa1FAuAW9jF0njyDyZpRuKYj WrRlVpNjtwY17QQMebrjd4Y2Ga8H9CxvFWWRasLFpYsUPg+j2fnN2BMJS7tbAt7ZHl9sZq e0bugc08lFf7SGJxoBoEJh7MeF20vuc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gVJlrrN5; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf10.hostedemail.com: domain of xiubli@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=xiubli@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655688636; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=m84C8oG+oFGyQ0i+A2o8bEJV9tjqcgrBl3QurQb4ooo=; b=IEZ7zMqU0dig/2hulS4PDGlxXsvwWaI6qVwmUgUucKGdKtXy3OG1m1GSien55UiVbYzM9n DhxkKDW8EVmNY2Dwbuqx+GDpVjeKgs69/+ODuA6Kgs+/gwxjP23clc3GQdjxLHTjqm1ReU COpm+cbWJmrz4AZvgrB2nA0854XECtQ= Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gVJlrrN5; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf10.hostedemail.com: domain of xiubli@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=xiubli@redhat.com X-Rspam-User: X-Stat-Signature: 9sop154cdtk1yyhhgxwogrogzynunrys X-Rspamd-Queue-Id: 690F9C008A X-Rspamd-Server: rspam08 X-HE-Tag: 1655688635-968379 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: On 6/19/22 11:49 AM, Matthew Wilcox wrote: > On Mon, Jun 13, 2022 at 08:48:40AM +0800, Xiubo Li wrote: >> On 6/10/22 11:40 PM, Jeff Layton wrote: >>> Willy requested that we change this back to warning on folio->private >>> being non-NULl. He's trying to kill off the PG_private flag, and so we'd >>> like to catch where it's non-NULL. >>> >>> Add a VM_WARN_ON_FOLIO (since it doesn't exist yet) and change over to >>> using that instead of VM_BUG_ON_FOLIO along with testing the ->private >>> pointer. >>> >>> Cc: Matthew Wilcox >>> Signed-off-by: Jeff Layton >>> --- >>> fs/ceph/addr.c | 2 +- >>> include/linux/mmdebug.h | 9 +++++++++ >>> 2 files changed, 10 insertions(+), 1 deletion(-) >>> >>> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c >>> index b43cc01a61db..b24d6bdb91db 100644 >>> --- a/fs/ceph/addr.c >>> +++ b/fs/ceph/addr.c >>> @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio) >>> * Reference snap context in folio->private. Also set >>> * PagePrivate so that we get invalidate_folio callback. >>> */ >>> - VM_BUG_ON_FOLIO(folio_test_private(folio), folio); >>> + VM_WARN_ON_FOLIO(folio->private, folio); >>> folio_attach_private(folio, snapc); >>> return ceph_fscache_dirty_folio(mapping, folio); > I found a couple of places where page->private needs to be NULLed out. > Neither of them are Ceph's fault. I decided that testing whether > folio->private and PG_private are in agreement was better done in > folio_unlock() than in any of the other potential places we could > check for it. Hi Willy, Cool. I will test this patch today. Thanks! -- Xiubo > diff --git a/mm/filemap.c b/mm/filemap.c > index 8ef861297ffb..acef71f75e78 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -1535,6 +1535,9 @@ void folio_unlock(struct folio *folio) > BUILD_BUG_ON(PG_waiters != 7); > BUILD_BUG_ON(PG_locked > 7); > VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); > + VM_BUG_ON_FOLIO(!folio_test_private(folio) && > + !folio_test_swapbacked(folio) && > + folio_get_private(folio), folio); > if (clear_bit_unlock_is_negative_byte(PG_locked, folio_flags(folio, 0))) > folio_wake_bit(folio, PG_locked); > } > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 2e2a8b5bc567..af0751a79c19 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2438,6 +2438,7 @@ static void __split_huge_page_tail(struct page *head, int tail, > page_tail); > page_tail->mapping = head->mapping; > page_tail->index = head->index + tail; > + page_tail->private = 0; > > /* Page flags must be visible before we make the page non-compound. */ > smp_wmb(); > diff --git a/mm/migrate.c b/mm/migrate.c > index eb62e026c501..fa8e36e74f0d 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1157,6 +1157,8 @@ static int unmap_and_move(new_page_t get_new_page, > newpage = get_new_page(page, private); > if (!newpage) > return -ENOMEM; > + BUG_ON(compound_order(newpage) != compound_order(page)); > + newpage->private = 0; > > rc = __unmap_and_move(page, newpage, force, mode); > if (rc == MIGRATEPAGE_SUCCESS) >