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 BC5F0C77B60 for ; Mon, 24 Apr 2023 02:37:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 618BD6B0074; Sun, 23 Apr 2023 22:37:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C8996B0075; Sun, 23 Apr 2023 22:37:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4901B6B0078; Sun, 23 Apr 2023 22:37:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 35D796B0074 for ; Sun, 23 Apr 2023 22:37:03 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E928612031C for ; Mon, 24 Apr 2023 02:37:02 +0000 (UTC) X-FDA: 80714722284.11.D2FB850 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by imf06.hostedemail.com (Postfix) with ESMTP id 1653A180009 for ; Mon, 24 Apr 2023 02:37:00 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=LB9RyMIC; spf=pass (imf06.hostedemail.com: domain of stevensd@chromium.org designates 209.85.167.53 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682303821; 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=gWLQq8LKSwpKlO+DVpyoCqxpg/jxNQlPguCAnZsIh90=; b=DGkZ1slWbdtavlu8hbQa2VADJvXjzLDktJBvkjNGsBr3DYuWbJEvY3zuIXUbfsytdTKO8b KTEONgh/XrYQ3/VbrOq96m4WqFQQItbOtG+05vR+ddkdLBOY8hggVZ5KoAy/K+kFoqF26y eipWsjvLFB8psN6Dw8iZeJ9hZ4RLjQE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=LB9RyMIC; spf=pass (imf06.hostedemail.com: domain of stevensd@chromium.org designates 209.85.167.53 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682303821; a=rsa-sha256; cv=none; b=a6CSE9Y0jgDKd2espXHWMmwcUHCyXEmiQWKkz3117g6ko7k6S85hPL9CK2yvyNATJPAS6k tvsrOsds9Rvc9PRkNzVL5LtpDeZip2RrY8C/UBKRJFyLfiDd2J2NCyBAqaL6USul9dw+78 4RPeUrLQe25JK7c/vzJQjySVl/pTca8= Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4ecb137af7eso3874886e87.2 for ; Sun, 23 Apr 2023 19:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682303819; x=1684895819; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gWLQq8LKSwpKlO+DVpyoCqxpg/jxNQlPguCAnZsIh90=; b=LB9RyMICWe0JD/uPys9DDbmoSRPAmmJfaXSh7z6aOye7DGHlMyjdUmVG4vqJNbp8pV h1r2QDK1jc5KTOZ+HSpzzEmO10TwuVupvw2jitg6mJ0sLVjFQdg+vgRQaC3U3c9YT4qB pBqglMev0wVg65GQPdDAQ2wtC4IqsM+3jq/b0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682303819; x=1684895819; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWLQq8LKSwpKlO+DVpyoCqxpg/jxNQlPguCAnZsIh90=; b=FzdPexMoxl7Ny9eRazf3piFHE/Ta9hVvYf7YnBDn5af5xinS7k4qWAUI7s25ZLRgft nD5mEHpt+jgfHK/t8h7qU9nTi+z5G7TstZ+6kgwjxOobQrrGAV++1xz9dEeYGmoq2wtT +95MrFE6W6AKIS6Rznae3sfK+CtctDdqtNICT8AbaKX4I0meQG5Tinw2UuFcZpx3qsOl NF6Vce3UPGk73TEWR5/pnt4XBGL4myhndow5wnfG2ghQt2SCJv6T5isZWfc0gO5k1hRO YD3FlRUbEmPeXQsLAv8wG7spgRpDdvqyfw0c6PE0RqIlibDuR9+CPTHLxWcPIFMHwtj5 24Kg== X-Gm-Message-State: AAQBX9c8gyOZ9m/UmI/xOXpxv3m0Qlaikj2yZWbFkHivg0GLiGqIST9w Z/a6jxyAPDGdtemo7Njzvj3XGxZgJ/F7PXfuk7whfQ== X-Google-Smtp-Source: AKy350Z0DyOZjTe/duYuceGdGau6TqY/bAIfJE1PcgLymUgU82dWm7YNaENHYqtRKyqMmaiId2KExqWwUmWVVy0Q5qs= X-Received: by 2002:ac2:5285:0:b0:4e8:c81b:1a11 with SMTP id q5-20020ac25285000000b004e8c81b1a11mr2788263lfm.49.1682303819370; Sun, 23 Apr 2023 19:36:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Stevens Date: Mon, 24 Apr 2023 11:36:48 +0900 Message-ID: Subject: Re: [PATCH next] mm/khugepaged: fix conflicting mods to collapse_file() To: Hugh Dickins Cc: Andrew Morton , Ivan Orlov , Jiaqi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1653A180009 X-Rspam-User: X-Stat-Signature: 8mqwbb1w6wnij1zysro966sqx181jm4b X-HE-Tag: 1682303820-168826 X-HE-Meta: U2FsdGVkX19wg7WynOhZT98S7FSm4SMqQdjgSpc9xwTgkDupWSmpIkD6QTjMAY9AHwnBumg9AXfBB4QSv5X+gs8Q356QQGzc+Mq0TvK9A0SCJuZE3XVsaS5TGzonmw+/nhdv5yBpTwKoCmHD33/ScH2W4tZWhM84Z/oDo0G7bVr/zTvDwnTyb1O57uZma8vdewxKXsqYWmg95ott1+WqdhsmAs4M1omFREDctx5zRESVxdaRHb0wO6Hm00iXF72SDHy340DWMkMr1Hxws4/XvLk7X8FP2bhemEDa8F0zGcDfZIj9O/Xr9vN/9FgxVm6sn3MJQXz5pv3tn8OS5i6XoutC3OkUNyjosq14fx6ZnCvQo+BDA7dMXhaB7EybBFNjVCCljsJeF9iSXZ6HjksZeWWvxS5bSF1H3MZRslgY+RG2R0VjvcoCH4e49cFHUMNCx6SODraVUB3lQ7IXvvpDju/XqPrbr6W3QsJ5tnQCvh5ydsX9jfkqy8GS1HdYBgus9EJHjttMZNBnVHKlkz93vmjlw/fF2ZWHIEX8X/4MItRpA4PZHoVNpS/1jzimFVxzxYhUB0MavfvbpQRaHMQtI5NW9g1GsbM8ImFvw8mM9NUvmvY2ybe2SSU7ZFbjlSwHApW6iXvrcMe5JxOqLrnYVk1joNU2nIw262TTsQI1yB3SLKYB46w1QLo4vGN4XTq2jPBXH1Y3qIgZmgMlcO8UUUlK8jSpUxGI3NvUwCbzRKWKnBYcfbUR2UbEeWSD6s9sPIHo5u1iExEVYAprXwhuHNPe06Zk+0xkx29P3LWRFKTrYhQu0Isb6TPQsFIh/SQ1xpYSnwIXPvFTYFZw4XPpaADUCCpn1aEWzrLOnf5BiDeR5AHajvokcGoKiCFN1Js+oJkLSG1YLq6fGg/DB+fjT60/pLhm4J1t+AbrkLnNRNpUjU72zjBPjCcEFlcTpVt9afojuAX6JdluRqN9hke 5jVcFjux Pmdc0w9EBqodrjZ6L0dZK5bDDhFkvBJJua9ZVNfrDbtuxvop4hZM666Y6+vl3GkChEjQ70jeitmajNUsEaMsuapDTWYAhZBSMMSVRrLkvxEKYfJjv4zlNXp3ap/AQQlx3PA/yNSgmti2GTMtVhsAtdH7/BWGC2cYME836EW5y6Uw2Ts45qcPRYRi9QhISqxcsEMT3bgaP9oY1Ls1B9pLA1Pbw76vbbez7BoeYnSwf96uYgIRF7Cun9P9y7zIyNMFv3W+FufYyMbFLUGAoxIIIu54Dsvj5Y8jAn0jhUgGMNmTpfSyuXU/BqfyFEQ7MUL83TC67pg99xY+JRP3/uJIo/kvnfDfxPrX7VS0Q+NpKM51zB78= 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 Mon, Apr 24, 2023 at 11:17=E2=80=AFAM Hugh Dickins wr= ote: > > On Mon, 24 Apr 2023, David Stevens wrote: > > On Sun, Apr 23, 2023 at 1:47=E2=80=AFPM Hugh Dickins = wrote: > > > > > > Inserting Ivan Orlov's syzbot fix commit 2ce0bdfebc74 > > > ("mm: khugepaged: fix kernel BUG in hpage_collapse_scan_file()") > > > ahead of Jiaqi Yan's and David Stevens's commits > > > 12904d953364 ("mm/khugepaged: recover from poisoned file-backed memor= y") > > > cae106dd67b9 ("mm/khugepaged: refactor collapse_file control flow") > > > ac492b9c70ca ("mm/khugepaged: skip shmem with userfaultfd") > > > (all of which restructure collapse_file()) did not work out well. > > > > > > xfstests generic/086 on huge tmpfs (with accelerated khugepaged) free= zes > > > (if not on the first attempt, then the 2nd or 3rd) in find_lock_entri= es() > > > while doing drop_caches: the file's xarray seems to have been corrupt= ed, > > > with find_get_entry() returning nonsense which makes no progress. > > > > > > Bisection led to ac492b9c70ca; and diff against earlier working linux= -next > > > suggested that it's probably down to an errant xas_store(), which doe= s not > > > belong with the later changes (and nor does the positioning of warnin= gs). > > > The later changes look as if they fix the syzbot issue independently. > > > > > > Remove most of what's left of 2ce0bdfebc74: just leave one WARN_ON_ON= CE > > > (xas_error) after the final xas_store() of the multi-index entry. > > > > > > Signed-off-by: Hugh Dickins > > > --- > > > > > > mm/khugepaged.c | 23 +---------------------- > > > 1 file changed, 1 insertion(+), 22 deletions(-) > > > > > > --- a/mm/khugepaged.c > > > +++ b/mm/khugepaged.c > > > @@ -1941,16 +1941,6 @@ static int collapse_file(struct mm_struct *mm,= unsigned long addr, > > > result =3D SCAN_FAIL; > > > goto xa_locked; > > > } > > > - xas_store(&xas, hpage); > > > - if (xas_error(&xas)) { > > > - /* revert shmem_charge perfor= med > > > - * in the previous condition > > > - */ > > > - mapping->nrpages--; > > > - shmem_uncharge(mapping->host,= 1); > > > - result =3D SCAN_STORE_FAILED; > > > > With this being removed, SCAN_STORE_FAILED should also be removed from > > the scan_result enum and trace event definitions. > > Only if we also remove your use of SCAN_STORE_FAILED in ac492b9c70ca: > what would you want that to say instead? > > I don't care myself for any of those "SCAN" result codes, nor whether the= y > are few or many: I'd rather have __LINE__ numbers for my own debugging. > > But if people want to remove SCAN_STORE_FAILED now, sure, send a patch; > my intent was to unbreak the breakage. Oh, I had forgotten that I used the code when I rebased v6 of my patches. I have no strong opinions one way or the other. Sorry for the noise. -David