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 E55BDC433F5 for ; Fri, 22 Oct 2021 17:38:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6EE8761052 for ; Fri, 22 Oct 2021 17:38:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6EE8761052 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 C6DD8940009; Fri, 22 Oct 2021 13:38:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF51A940007; Fri, 22 Oct 2021 13:38:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A96EF940009; Fri, 22 Oct 2021 13:38:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 92FD6940007 for ; Fri, 22 Oct 2021 13:38:55 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 41C683A7CF for ; Fri, 22 Oct 2021 17:38:55 +0000 (UTC) X-FDA: 78724783830.12.3A11F20 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf27.hostedemail.com (Postfix) with ESMTP id 609E970000A7 for ; Fri, 22 Oct 2021 17:38:53 +0000 (UTC) Received: by mail-ed1-f48.google.com with SMTP id t16so8059446eds.9 for ; Fri, 22 Oct 2021 10:38:54 -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=fPYoNgwJMJvckGbmwxEVj2HyEBD3w36KB+IYdEkY6MA=; b=mE2xVjVmqMBiKP6FhQOYRc8CsekC8hhuCCX2rrVntAwz6qOcMTy7O26tWxYizEvw4R KjHQZ+jUq+Miy9RpBhX/pWtQjr9OW8QFoS/ZWiTmkp+i/WQDqciTtSNMoYGl88/MmNB4 /0H6RALFCt11WN+BdTb3m+vVXVE3Qkp0O2jTYCVgibwY5wSWi9HsuMJ0IHijC+6hhjex O6MZ15HgDh6EKX/W3oxvbnXjxPVo4b9TqdaH+ZXFnKjb2ngIdY0aP2f0UvXJMEsQctCg CEsF92Jo/WT4GIAnD9qS+6bJ5N9zteQlBEafCNyaeh7pZ0AGQrYkp6RF0GJkElwZmH9g HpzA== 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=fPYoNgwJMJvckGbmwxEVj2HyEBD3w36KB+IYdEkY6MA=; b=MHnezJfFfyeeSi/gMrSlkijJi7jwD6IvH4H0pIfl6Cjv+9Ap2ANV+Ddj6lnTbGEVTG 77XtRSspa+k7lzRXXiwmiebbcC9xW8aGJbIGcLEfkHNxK3mPWcO3EEkSvzR6hiFb/rlE Q8dLns36YE+MdLaa9FgNofHvHDW5xqQ3O7uTHiGqS4SWrNTrHjPLD21jtllhazoTuCFz HqnqazIyuBDJI3r5Ly9pSKzNZezi5plz/P72604ZN7fTYH6iBafjcB88ocJsK4CZgMd7 NjKlEPobIEa/kPC+p9OaqHsKtksT0IilrEkltku9/ulYCjvUJwhjuFsAdxV8YXQxyZq6 b+KA== X-Gm-Message-State: AOAM532kilsYOkbS0b6SUpDKpNYEOR5ths9qg9xV5zAiDJQbdQ1UEIfp 5xo/p1FOC1oiVuQXkz79hEhzelRwFIutpi2W17E= X-Google-Smtp-Source: ABdhPJwBJTsdQIOewen+qXgbUpm91ooQGoBqoe1jLp1ZXH6lFLQH6dEa3Dthq8fs5Sy6h3IvJfJc0pvFMPWx6shcIo0= X-Received: by 2002:a17:906:470f:: with SMTP id y15mr1048897ejq.521.1634924333542; Fri, 22 Oct 2021 10:38:53 -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 10:38:41 -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: r5jgxtomkbxygr5jx3twpws3y8d4qk9n Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mE2xVjVm; spf=pass (imf27.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 609E970000A7 X-HE-Tag: 1634924333-648104 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 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. >