Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1949808pxb; Fri, 22 Oct 2021 10:41:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqKfd+9kf7k6cwOgdGuo4jAm1gk9DtFIsF8WKhFMP4bi0jT+YnDKJtdIAv/a1lo6pzcWX1 X-Received: by 2002:a05:6402:2887:: with SMTP id eg7mr1777203edb.93.1634924476140; Fri, 22 Oct 2021 10:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634924476; cv=none; d=google.com; s=arc-20160816; b=hYaN191rBgiC1Xnp8NuMM2p3l28gZkuwOpE8yl8QN71Nc5dAk4pZZ/Ukzv9TZFFdOx p6tU53vBMvbE1nDHC/4n1/8JpQPZizC0TLqR7IzRbBeXJ4FuRWCsbPU+KXZwUEHEReeJ RakHmebLCqkiso0R4ONo3Asz4A0obrevrmvsE2GznJVz3a0iY1IT3G5PwXyQfEoL+SyF MkWT4eE/bWEZOmpictUiiSBzz3iNydcsgtyRBmJ2jzn3WwwA2Sr8Nr18BEGMl/872MoY rbAQ/+3TW4v5+QKW37aot8UwVEOVt9OAzAkadZORLtW47CRjyPpeoOcPRuTqP2CWZuzd SIaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fPYoNgwJMJvckGbmwxEVj2HyEBD3w36KB+IYdEkY6MA=; b=L8Zj3rQkg/N4AqMnL/5p1IYnTCgQYU0sXCiRGgpSM4dDy3notuigoTegFR5NL/YZ6s DZwfVVWVYgW7r17u977hfnbo1LRRq5piERIDmk2M5x60bGcfabEoBZL+2qwpzdPymFsa h+1ORR9iQKE7bsyrkw5uSKsBTROb8Bh/QTBa4vT7kf+a0LjpinNpPITujZtjGHLo+uq2 LmA7O07NDWmnAN4o2rqzhQYcW1WYpczC32HrGk3/DWmyuSw7qFt/QuhhGg7XhqFCMgh/ C7aQ6WlEeunw1g+xAH0LAmU+9cds54GgDF0O6CrubYF+k2t6eOElG0U0pzjbVkoQO+OY +o4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mE2xVjVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si10342403ejt.760.2021.10.22.10.40.50; Fri, 22 Oct 2021 10:41:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mE2xVjVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233764AbhJVRlN (ORCPT + 99 others); Fri, 22 Oct 2021 13:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231893AbhJVRlM (ORCPT ); Fri, 22 Oct 2021 13:41:12 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D87CEC061764 for ; Fri, 22 Oct 2021 10:38:54 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id g10so4347534edj.1 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=v+zop6SCSY+A9ieBZLrDtCfmdrJ6f16F1LWUPpH/2nZqWZjguE7ZsedBVy8JRbCsvX Wtl9OZyxoAA/hH3FNhlsqDxNraIeCHRDB8r6oUMjlGv+6cwa//BVdg3qwYvC+4LInUHH AWlNde7gUwCJmeQkk5zYkddS/2ba16Zu2xtyVCC9npBvqiSnYvtZ8clzpsbnBxKMFGrI xIpY0T8nxoEYKDTdievOGK3jbX2Io18ssCNq/dqu4HpN/yUXlcjofPy1LjBZyWR9/Sp4 ZptF8ZsGTmRJwOf8VNvKppG8ZbnkFikg4X/h5rwtV27kaNvjKt9rZl7qYClJGKaut6N8 wFhw== X-Gm-Message-State: AOAM532XJkieB4/6tZQmixbLyCFtJvSrCZOvnXGOAgztMJ8L1YlCmLZh kJzZow5mI254r7GGRJUo/vNd4zU6CCIU+fnyy0lMFwnHQxA= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >