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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D25EC433E2 for ; Tue, 8 Sep 2020 22:06:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1B68220936 for ; Tue, 8 Sep 2020 22:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ShxeRLEq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B68220936 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F2D956B0055; Tue, 8 Sep 2020 18:06:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDD976B005A; Tue, 8 Sep 2020 18:06:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCBE86B005C; Tue, 8 Sep 2020 18:06:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id C78BE6B0055 for ; Tue, 8 Sep 2020 18:06:52 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8ACC68248047 for ; Tue, 8 Sep 2020 22:06:52 +0000 (UTC) X-FDA: 77241279864.03.fold31_48059ac270d8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 59E1128A4E8 for ; Tue, 8 Sep 2020 22:06:52 +0000 (UTC) X-HE-Tag: fold31_48059ac270d8 X-Filterd-Recvd-Size: 4025 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Sep 2020 22:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WCPxAxdijxd3T5V/pNBI5jftYERTjzAxjTmEqEpA1qg=; b=ShxeRLEqq6Fmnkk3QexJRnoLib MRNgeMN0lDYX2oJzH97h6VQQ06hEHLqzkXBnveQkwTwHbXEwKrQ9Gt4hp8/menoFH26gOCAcKgr0D 7u5ueZxDnQeaP49X07zCOBrmCqOq57fevIU9b9UNvfsMRM6MpHwaCR0AU1UEM/g35JbDjBkg/K0ST +Umg55PVdtRMbrY+B5c50IwlF75W8xmx2hJqz3hXc68J60SOJw40ugL3zW7KYj7enmOUgi5WJw3JW rrhweRwnfON5TDlzX/Ug7WUlOKA9OPBU4oLBt2YfLzl16BUzhYqF6ZKJyX1fC1oHNuc42XO0CCFT/ t+mWZHxQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFllE-0006o6-CG; Tue, 08 Sep 2020 22:06:44 +0000 Date: Tue, 8 Sep 2020 23:06:44 +0100 From: Matthew Wilcox To: akpm@linux-foundation.org Cc: mm-commits@vger.kernel.org, songliubraving@fb.com, kirill@shutemov.name, cai@lca.pw, linux-mm@kvack.org Subject: Re: + xarray-add-xas_split-fix.patch added to -mm tree Message-ID: <20200908220644.GA6583@casper.infradead.org> References: <20200904172353.gfJQP%akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200904172353.gfJQP%akpm@linux-foundation.org> X-Rspamd-Queue-Id: 59E1128A4E8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 Fri, Sep 04, 2020 at 10:23:53AM -0700, akpm@linux-foundation.org wrote: > From: Andrew Morton > Subject: xarray-add-xas_split-fix Can I ask you to add another -fix patch? In my testing, I found that splitting a THP that was of order 6 or higher meant that marking it as dirty no longer worked. It was pretty weird. I figured out that what I was doing was setting all the mark bits in the new child node unconditionally (instead of only if the split entry was marked). Once the mark bits were set in the node, calling xa_set_mark() no longer works because it sees the leaf of the tree is already marked, and so it does not walk up the tree to set the mark on the parents. And thus the call to xa_get_mark() never walks _down_ to see the child is marked. It doesn't affect your tree because it's only used for read-only pages, but in my tree it causes failures once I induce splitting to happen more frequently. I've included an update to the test-suite which ensures this doesn't happen again (if you apply just the test suite update, it'll cause failures in the test suite). >From edcd692083586b2b218ce3d935429a2349969ba9 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Tue, 8 Sep 2020 17:55:22 -0400 Subject: [PATCH] fix xarray split --- lib/test_xarray.c | 3 +++ lib/xarray.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 37f7fed3e982..4115979cc716 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -1546,6 +1546,9 @@ static void check_split_1(struct xarray *xa, unsigned long index, } XA_BUG_ON(xa, i != 1 << order); + xa_set_mark(xa, index, XA_MARK_0); + XA_BUG_ON(xa, !xa_get_mark(xa, index, XA_MARK_0)); + xa_destroy(xa); } diff --git a/lib/xarray.c b/lib/xarray.c index 53045e14ad22..9180a7d48315 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -973,10 +973,11 @@ static void node_set_marks(struct xa_node *node, unsigned int offset, xa_mark_t mark = XA_MARK_0; for (;;) { - if (marks & (1 << (__force unsigned int)mark)) + if (marks & (1 << (__force unsigned int)mark)) { node_set_mark(node, offset, mark); - if (child) - node_mark_all(child, mark); + if (child) + node_mark_all(child, mark); + } if (mark == XA_MARK_MAX) break; mark_inc(mark); -- 2.28.0