Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1550613pxm; Sat, 26 Feb 2022 19:09:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxv952rfg1+uj5wnW25d0qb08UyYxiZzzuyQTOmw4zG6f5PKx0UKQrsFFaAYLcNqvuwvPLY X-Received: by 2002:a17:902:e542:b0:150:e0a:c21e with SMTP id n2-20020a170902e54200b001500e0ac21emr14802801plf.59.1645931366475; Sat, 26 Feb 2022 19:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645931366; cv=none; d=google.com; s=arc-20160816; b=Q/unZQEPTUMY5u7Qx3ulZtod7dFL3vAJHrRYRvZkDKOIeBcg+VNhOCCE440TZfmikr GAAwWIF45JiVj0IbM4Rzskn47VYahijvJ+Pol9dpKikrT9Qz4Z1i1C1qs5f2RkORaGSu utCTlyByzaY8pcWoEDa0Cxwro18jbsdp4EQqyt3W8+Aa5IR5cAbsANplUfKQezJ23OUx GP9ggEVNvYYktDTZgGBUG8gUSjVXw5RoiKhTg3BUHS0C0yUlOgvoMMQ8MJ5grkwYqyV2 udaNsA47oQ5vgu0HhITifej8ZkY/C/HdaT5O8TguoLVPgO1boGlVaU3wk/Qf7S46Fn9I SCAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=1vfHk8IgXV9x509jvY8zplci3eeq7Q2rCPdWsLWLaHw=; b=sAhm8q0ksLxkUkcHu492a/TMHSj7cvSjwl44FrazAFmbOPjgG2BjhFL9PsPMMbT4i5 drGpqTDmWcsSgDHr7vMUqiTWQTwI17JcOrqyIpyI6GiVmFmGIlV5vgs6qm7jg3NNYLIy A9AiEXlF2htWptm9+xwB7QoVHji30j+EZCHX2an1Mj579l6RiCiRHabe+/UQtR2scAHR /4jUAV9sQdylO3XP/2ssexUniqv87VNPhMRW59Q59I8d/ElQ/ESD66amGAZrRcEWAfRq fMn+YFLtnMEGWAw2/B3REedP8CE7B3SyXCSWRob6DK9GapRuJw24eIejeX6OE+HfgSim R3QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ITJX+LIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f29-20020a63755d000000b003747462956esi5918506pgn.718.2022.02.26.19.09.00; Sat, 26 Feb 2022 19:09:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ITJX+LIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbiB0CXf (ORCPT + 99 others); Sat, 26 Feb 2022 21:23:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiB0CXe (ORCPT ); Sat, 26 Feb 2022 21:23:34 -0500 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B105AF0D for ; Sat, 26 Feb 2022 18:22:58 -0800 (PST) Received: by mail-qk1-x736.google.com with SMTP id c7so7795544qka.7 for ; Sat, 26 Feb 2022 18:22:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version; bh=1vfHk8IgXV9x509jvY8zplci3eeq7Q2rCPdWsLWLaHw=; b=ITJX+LIycQvk7DRc7SzlB5nlr7w9MDymPNVLBONq1Eqnxgho/XvwLuTjl1fsyU8hc3 qxgWWdoQF6wdw0WNHfNLKJLk0xPd7APFoHx28rXARWrZ5/4VGU//GvlObRAPWGbSZKyd ue7dN8F5uV8XYOVGRKbWLLCJZ2q2QL8rWNURqceRWS8fFyJj8VbyDTLvxR1psjjOLL9r gpYekmdc71U9RdenOd56OPTYbYQO7lQnTwjIAsKxE+1NVHxwCGDYXHNz5jI6Au1SMwhr 18YRLjJADJBJK8XhoICZona/j4zG6vR2je+SqO5jxiu+3majTk1VIc6S+ISD726vcbSe NkUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version; bh=1vfHk8IgXV9x509jvY8zplci3eeq7Q2rCPdWsLWLaHw=; b=6uMyn0iDE8PXB6QD5xlzAy9Tx+eFlyOlYXE2rq6Xpspu+rkVZOqvneuI1tgBJBUqLc ci+YMZ71Wffx4fYNE5D5wdRDBPMFhrI2lgwmItmQLUWKXLGxyRraUqj5WVdiaMeBlvCX 0LsVsPOUxd3l+Y6EsBZ66Dgv1v1JPgZj+8tOAyPkOKUotYQFaXOH71lETONKcpx+GHBI +7gpT9MqMkgjT3oRNyo602gS46rQFhp45duf2REoAOw7rEJc4OAkK/+YEKyyPFCFMw1f lr3ThKCIfND0F+0kjKUFrFBWk56IuaZSCXftT8c79DT+CPuKgkii19KMN4TUZXuy2Pwt tgsg== X-Gm-Message-State: AOAM5311mTjLcFs/ajReWpYKTRislcfsGY4GIuKRDpPaplVSdNm+nJLN PhaIFMcFCHP8YML8XCWEgcMZtA== X-Received: by 2002:a37:a88f:0:b0:47e:1590:d7e9 with SMTP id r137-20020a37a88f000000b0047e1590d7e9mr8558916qke.733.1645928577318; Sat, 26 Feb 2022 18:22:57 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id f1-20020a37ad01000000b0064919f4b37csm3140532qkm.75.2022.02.26.18.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 18:22:56 -0800 (PST) Date: Sat, 26 Feb 2022 18:22:47 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Matthew Wilcox cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH next] mm/thp: fix collapse_file()'s try_to_unmap(folio,) Message-ID: <3f187b6c-e5e8-e66d-e0c0-7455ca6abb4c@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-16.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FROM_FMBLA_NEWDOM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The foliation of THP collapse_file()'s call to try_to_unmap() is currently wrong, crashing on a test in rmap_walk() when xas_next() delivered a value (after which page has been loaded independently). Fixes: c3b522d9a698 ("mm/rmap: Convert try_to_unmap() to take a folio") Signed-off-by: Hugh Dickins --- Please just fold in if you agree. mm/khugepaged.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- mmotm/mm/khugepaged.c +++ linux/mm/khugepaged.c @@ -1824,7 +1824,8 @@ static void collapse_file(struct mm_stru } if (page_mapped(page)) - try_to_unmap(folio, TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH); + try_to_unmap(page_folio(page), + TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH); xas_lock_irq(&xas); xas_set(&xas, index);