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 B75E4C433EF for ; Wed, 5 Jan 2022 19:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BEB86B0071; Wed, 5 Jan 2022 14:05:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 36D886B0073; Wed, 5 Jan 2022 14:05:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2356E6B0074; Wed, 5 Jan 2022 14:05:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id 163E66B0071 for ; Wed, 5 Jan 2022 14:05:58 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CB260181B3AC2 for ; Wed, 5 Jan 2022 19:05:57 +0000 (UTC) X-FDA: 78997163154.28.80CD5D5 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf13.hostedemail.com (Postfix) with ESMTP id 5A9AF20006 for ; Wed, 5 Jan 2022 19:05:39 +0000 (UTC) Received: by mail-ed1-f45.google.com with SMTP id m21so559395edc.0 for ; Wed, 05 Jan 2022 11:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QaOZQ0OUuHDLxriDkymCTGEPKjB60kDV2I9cpOteQ2U=; b=TjeHxlu90TTQ95wxkxQJaNIuybmeIYTrZbiFamYLS0GAEfXyvXCPApfpPLk0bfplbE CQ3TadGk+TFQbe6j2luKjMY6yKyp7uEsjNMZhKURQlN4mmXhoGr1IhCadw+1HAkcxz9Q QBU2didKB01Wu6u4Ts0zvQhAZKAcK7xf86uTnNzYuRFfAFYLMGhSFnPUwu9g/xgkhJc7 Z4ZfxPwTqkwOjWceT3Roj1etOhoz/0BOBfWUe5YlstavVWWmvqPt0+jKkVwvvU6Imf9t o9ZxUznQ8nsFeyYyDEtRw8O/uG6KAX0fYfqK+ju4zHObD9F50KkjGH04MDtuyRciH+NT vyOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QaOZQ0OUuHDLxriDkymCTGEPKjB60kDV2I9cpOteQ2U=; b=W5Gcd+/3X7lHXLbhPPUVhATzvKvMieH2rKa6ZquxJxTwR32KJWzGSnlkzLK7O4ONTR xruzb/pYYEgWFKvG/+hjqXYjQhSeroyiZmX9jJfm0S0/lrIdQdHm51Oy+dQSLYtDEo2t yBZmFmERqIh4fggU/IK/rpaZk4FuM2ry4TFi8qHZqn9AYRQOn75lqZnd3okbieHgQY7f gt1/bRdaMUmOvCbCmGBm3MQ3AHd7sRleMFnBeaVutRxNsfe3YOEqe/M6qgOCwmgTmaVj xWPbOvfrTIloI+VFIxIin5DJdtNGeoYObkrMMGZfuykiycpYRFhnEmmN3D6pmT2HRBXO iP5w== X-Gm-Message-State: AOAM5320fIUqLIdb3uMshkbTQrLlEmE/bKHEnsyBeB5aZ/tpkGPhy6Ah wkx+GCygvsOQNQTKmLkiwg6WYxZPz8X4hH0UUqI= X-Google-Smtp-Source: ABdhPJwbaXebUAFb9swq2o131QbPOqMyMsX8CUnROGp26DPv5QJJ5q//ZQvaXFH50XOPGFNyJ09h/glumGq88GL2MZ8= X-Received: by 2002:a17:907:da3:: with SMTP id go35mr44838487ejc.637.1641409556068; Wed, 05 Jan 2022 11:05:56 -0800 (PST) MIME-Version: 1.0 References: <00000000000017977605c395a751@google.com> <0000000000009411bb05d3ab468f@google.com> In-Reply-To: From: Yang Shi Date: Wed, 5 Jan 2022 11:05:44 -0800 Message-ID: Subject: Re: [syzbot] kernel BUG in __page_mapcount To: Matthew Wilcox Cc: syzbot , Andrew Morton , Alistair Popple , chinwen.chang@mediatek.com, fgheet255t@gmail.com, Jann Horn , Konstantin Khlebnikov , "Kirill A. Shutemov" , "Kirill A. Shutemov" , Linux FS-devel Mailing List , Linux Kernel Mailing List , Linux MM , Peter Xu , Peter Zijlstra , syzkaller-bugs@googlegroups.com, tonymarislogistics@yandex.com, Vlastimil Babka , walken@google.com, Zi Yan Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5A9AF20006 X-Stat-Signature: cofjh4wicukkujsmakxoeytubar4qi8c Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TjeHxlu9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1641409539-377101 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 Tue, Dec 21, 2021 at 10:40 AM Matthew Wilcox wrote: > > On Tue, Dec 21, 2021 at 10:24:27AM -0800, Yang Shi wrote: > > It seems the THP is split during smaps walk. The reproducer does call > > MADV_FREE on partial THP which may split the huge page. > > > > The below fix (untested) should be able to fix it. > > Did you read the rest of the thread on this? If the page is being I just revisited this. Now I see what you mean about "the rest of the thread". My gmail client doesn't put them in the same thread, sigh... Yeah, try_get_compound_head() seems like the right way. Or we just simply treat migration entries as mapcount == 1 as Kirill suggested or just skip migration entries since they are transient or show migration entries separately. > migrated, we should still account it ... also, you've changed the > refcount, so this: > > if (page_count(page) == 1) { > smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, > locked, true); > return; > } > > will never trigger.