Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3325908iog; Mon, 20 Jun 2022 17:18:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uWMIGMH/YcOxxVPmQwFKeFNOwZ49HmYKwSpef5LP/WPpXO2QMtHHAee2pwcZcZEYWW2Wa0 X-Received: by 2002:a17:90a:f288:b0:1ec:7f71:b05f with SMTP id fs8-20020a17090af28800b001ec7f71b05fmr20423346pjb.184.1655770709788; Mon, 20 Jun 2022 17:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655770709; cv=none; d=google.com; s=arc-20160816; b=u5HyVBTCbBSduiY0HnblJvRm1Gi1FfNFAenaVF6PHBG6f2Pmj6fZH7p0i9emP4abJX 0D3z2U5bSuM30jj3h1R+ds6xp2cR8EsK9GYPYwxSJsSwJoViCCJEo83V5keaOpy+r316 PVuLk7az+LDRid+CHtZX3MyxnGLRs0cQl6SDNEubkglu9ovWhwc74CkKXmhOlHyCFJmp NTxCRdZNFljXr/aTs2mOWD6qsBPGq3c1d9syofvLmtgvUqQP7Z4IzqJ6qshMwzcnjlrp m1Aw4P+3M9A/iWqV5W01ii16f3l2C5R2U42LCs1u0rS74RkiTycjdZZkElSXoYShSZwK jBPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=loNrawDUVj3mdCQPJAzyrH5o/8r/aVwsRAwGWDR9o6c=; b=koB9w9FRyBYPi90Wr8Ui8sMmNCY9eR8A25CyPKZXyBSlfeZF66vCxJLIk3LTf0iWCK mK96r90Pw9JdEQDzNyfuElMEn/nmi1qJuD3xbAt2BfCCwCMthDBTqfm+xExm5UoW+7xz R8GvAQV9rjteGr3hHYgPOs8P+mzv7jQJB6VxDeu30f9aJPHUfhcz2A0A2Xa8ttwij9Vy C0KbBDiZxg4jebqGwg5cqfFzlI9j4UW2l+Y05Kq1IHxH+RPyBU26OAOwxne73kvrGipK MaohA4ysAgCTYbYJwT/59MbXrNOC+YY13uaYMZkGzYIlL6Ew6/JqqD5MrJ6oxeFGeo0S RoHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bjdQ8xun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a62bd13000000b0051c4b1e61dbsi14441000pff.280.2022.06.20.17.18.16; Mon, 20 Jun 2022 17:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bjdQ8xun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241911AbiFTXmh (ORCPT + 99 others); Mon, 20 Jun 2022 19:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237257AbiFTXmg (ORCPT ); Mon, 20 Jun 2022 19:42:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B5DE1B7A4 for ; Mon, 20 Jun 2022 16:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655768553; 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=loNrawDUVj3mdCQPJAzyrH5o/8r/aVwsRAwGWDR9o6c=; b=bjdQ8xuntHW6wIp9VUyDF81TJL7DcwUemt393mErnP9TYLgAcFmoC+kT78nCXVPfG22pxb iXJCQljrayI5hKOJH5iULJdOZjFiaNzQDld3tcbAkmn0+YuJvqbfQqLSKY8fO9gaoE+AAu lPZCReRTu5l2z/HpKmjAPH37MQB+SLs= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-izl9joKEPu-0QuAdIzbgzw-1; Mon, 20 Jun 2022 19:42:32 -0400 X-MC-Unique: izl9joKEPu-0QuAdIzbgzw-1 Received: by mail-pf1-f200.google.com with SMTP id bq15-20020a056a000e0f00b00524c3c1a3cdso4562590pfb.17 for ; Mon, 20 Jun 2022 16:42:32 -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=loNrawDUVj3mdCQPJAzyrH5o/8r/aVwsRAwGWDR9o6c=; b=JkhUx8PrXScKZrOWFVPPL5g0Pyw7KSXmiaGTe1S7d5gWyeflX7H64sjak8qfgPhhGX 3e8pakvly+2CVuS8TWUzzsdydjM58KWb37RddF3nRm/nKgRZq9ahCvCxFDNAdPNmgGcD B9oFsgaHCV81XyoHOLbUX3YsZPon/gQoeDD5IgnupVLqQC/+CNjiZbJyr+P3iL4uQRa1 eoOakcZAgqICORm+F0pbmYSbWnBmHo2A2qylRzy1KqXOVQzX9wjcLUk4hfNKJAKYWwP7 roFqezJ4Uqw+aJFawcbXrILh2Q3sslcrzZCP7/Yo4VhYg543UKbFK/II1Bpln7nQ+j9J xpbw== X-Gm-Message-State: AJIora+2paDsSdLGkqPlqbh5ZNGeiIiPmeW8BOmMoNTZG7YEr4uibbEB as+xHan44gUuI3pvRr0ikPmRkvkqBaGqcyWWoW7tIukDCzkeMjSG6eSIlNSl09qC0gPEKB93RVP eR+0u5QtiZcl2oEdKFvdM/FGQXWpgBfPc2lbnyjj5HEOqcv1OEFhUjGesr9T5WNYTjWv0vqc5Yg == X-Received: by 2002:a05:6a00:a06:b0:51e:47f5:79ad with SMTP id p6-20020a056a000a0600b0051e47f579admr27112522pfh.53.1655768550190; Mon, 20 Jun 2022 16:42:30 -0700 (PDT) X-Received: by 2002:a05:6a00:a06:b0:51e:47f5:79ad with SMTP id p6-20020a056a000a0600b0051e47f579admr27112494pfh.53.1655768549770; Mon, 20 Jun 2022 16:42:29 -0700 (PDT) Received: from [10.72.12.43] ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id q23-20020a17090a065700b001ec9ae91e30sm3437393pje.12.2022.06.20.16.42.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jun 2022 16:42:29 -0700 (PDT) Subject: Re: [PATCH 3/3] mm: Clear page->private when splitting or migrating a page To: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20220619151143.1054746-1-willy@infradead.org> <20220619151143.1054746-4-willy@infradead.org> From: Xiubo Li Message-ID: <88cbf01f-a82e-f527-b343-73f85cc6f1c8@redhat.com> Date: Tue, 21 Jun 2022 07:42: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: <20220619151143.1054746-4-willy@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/19/22 11:11 PM, Matthew Wilcox (Oracle) wrote: > In our efforts to remove uses of PG_private, we have found folios with > the private flag clear and folio->private not-NULL. That is the root > cause behind 642d51fb0775 ("ceph: check folio PG_private bit instead > of folio->private"). It can also affect a few other filesystems that > haven't yet reported a problem. > > compaction_alloc() can return a page with uninitialised page->private, > and rather than checking all the callers of migrate_pages(), just zero > page->private after calling get_new_page(). Similarly, the tail pages > from split_huge_page() may also have an uninitialised page->private. > > Reported-by: Xiubo Li > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/huge_memory.c | 1 + > mm/migrate.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index f7248002dad9..9b31a50217b5 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2377,6 +2377,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 = NULL; > > /* 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 e51588e95f57..6c1ea61f39d8 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1106,6 +1106,7 @@ static int unmap_and_move(new_page_t get_new_page, > if (!newpage) > return -ENOMEM; > > + newpage->private = 0; > rc = __unmap_and_move(page, newpage, force, mode); > if (rc == MIGRATEPAGE_SUCCESS) > set_page_owner_migrate_reason(newpage, reason); Test this patch by reverting my previous patch for many times yesterday, and it worked well for me till now. I will test it more to see whether there are other cases could cause the crash. Tested-by: Xiubo Li -- Xiubo