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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8837AC433F5 for ; Fri, 22 Oct 2021 18:14:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0EABB60E08 for ; Fri, 22 Oct 2021 18:14:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0EABB60E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 738EB940008; Fri, 22 Oct 2021 14:14:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E7E1940007; Fri, 22 Oct 2021 14:14:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 561F7940008; Fri, 22 Oct 2021 14:14:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 42C32940007 for ; Fri, 22 Oct 2021 14:14:07 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DF588181AF5C1 for ; Fri, 22 Oct 2021 18:14:06 +0000 (UTC) X-FDA: 78724872492.25.CC828A5 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf12.hostedemail.com (Postfix) with ESMTP id 84828100009D for ; Fri, 22 Oct 2021 18:14:06 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id ec8so4805814edb.6 for ; Fri, 22 Oct 2021 11:14:06 -0700 (PDT) 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=iUVy5Ei4KUMRiHJuf/GMekzWocYSeyLp9wteBIU/ENY=; b=B/70PtVdeJ6+wPmvf7bBT0YVw1ghfn6KBLNqkkQuC6l2NW4eKbB9vAyPnp88HJHHol tLumGJNSClhbqCsdFi3ToCWvFL52qJCIGjcRY/KqjIvysGlPB33pCq2nsWnORgHsr0p9 0lVmCLTvHLv22KFp/AeZP70iupYrT16mqO7xxaYFHNIxFmD3A1+Zg4Kx6sB1CzhqYZGi YJcS9AXbCOj78lyXscRYMzB7OH4D1uauXHIHCU9kAOBz0f8vVjIUbl5EATc+59QOictB wkL/UO++/fqB89+6lgs25/lonIMGDTKlG8FVqGEp9K9BJhIuzckvRyGGlABWEtjbqURA SRFA== 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=iUVy5Ei4KUMRiHJuf/GMekzWocYSeyLp9wteBIU/ENY=; b=3z+Q2n7F6Q0DOzqT9RFHXVRGtOnTY2ym40XqnRHHI9YmFZrvfLOXdTGKXK2QxNwGFQ i28jqwkTVJwlye5gJjrtlWMHy8COBvTtv//7Ptt3K3h9owkg/ZFq4vYRV2vUjSRzGnq5 6/btAH1mF9V9u5uj5hzw21G5zHFdh+o5tyvykMaYWH/k89mRLL17Rj+NcIzO5Ghxpo0H X549wOKbCBxhZ/FGFH69tMlUod1OHDncrAubNkU4FWAZZXQKW6dfmU2d/W1OZ9kk04Oa pCZbLRozFY/yVwtTHLuHYyQ6jitey1docq8AoyyYpLcDvBKTWb2/37dQ2BjxJ/fsdjbh NjZg== X-Gm-Message-State: AOAM530A2yC67UCA7lXy0tkTjWWBqq4gTh3zw9Kk5T4dHunvk6ynJPCh tvyA/OPiN2l3cTkYsurbhur/fj+c4/WUQQPQ1z8= X-Google-Smtp-Source: ABdhPJwu4v3tFaybD5BXKvUuVzy9ahipsz/WXWVpaQOAkhbmqXaIyHcWB9ef8rv9818NiEDurbf7YkDJtcVPvMTugYs= X-Received: by 2002:a17:907:2091:: with SMTP id pv17mr1343837ejb.311.1634926445307; Fri, 22 Oct 2021 11:14:05 -0700 (PDT) MIME-Version: 1.0 References: <20211022074619.57355-1-andrea.righi@canonical.com> In-Reply-To: From: Yang Shi Date: Fri, 22 Oct 2021 11:13:53 -0700 Message-ID: Subject: Re: [PATCH] mm: fix sleeping copy_huge_page called from atomic context To: Matthew Wilcox , Hugh Dickins Cc: Andrea Righi , Andrew Morton , Yang Shi , Minchan Kim , Linux Kernel Mailing List , Linux MM Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: h6jy77xbwxrck6jm1dikdkbrgdfc1kp8 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 84828100009D Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="B/70PtVd"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1634926446-377089 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, Oct 22, 2021 at 10:38 AM Yang Shi wrote: > > On Fri, Oct 22, 2021 at 4:16 AM Matthew Wilcox wrote: > > > > On Fri, Oct 22, 2021 at 09:46:19AM +0200, Andrea Righi wrote: > > > copy_huge_page() can be called with mapping->private_lock held from > > > __buffer_migrate_page() -> migrate_page_copy(), so it is not safe to > > > do a cond_resched() in this context. > > > > > > Introduce migrate_page_copy_nowait() and copy_huge_page_nowait() > > > variants that can be used from an atomic context. > > > > I think this is a consequence of THPs being created when they should not > > be. This is the wrong way to fix this problem; and I suspect it may > > already be fixed at least in -mm. We should have taken this path: > > > > if (!page_has_buffers(page)) > > return migrate_page(mapping, newpage, page, mode); > > > > but since we didn't, we can infer that there's a THP which has buffers > > (this should never occur). It's the same root cause as the invalidatepage > > problem, just with a very different signature. > > Yeah, exactly. And I replied to that syzbot report a few days ago > (https://lore.kernel.org/linux-mm/CAHbLzkoFaowaG8AU6tg_WMPdjcAdyE+Wafs7TJz1Z23TRg_d8A@mail.gmail.com/) > with the same conclusion. > > I'm not sure why Hugh didn't submit his patch, maybe he was waiting > for the test result from the bug reporter of that invalidatepage > issue? It should be fine, the fix is quite straightforward IMHO. Anyway if Hugh doesn't have time to do it, I could prepare the patch for formal review. > > >