Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2792322rwd; Mon, 22 May 2023 04:34:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ciTv/cvfVGKCQRewqHZukL0bnufN3g+uolpNzHkSI9T58fyViHAmGpSPojxlVpEuykSv2 X-Received: by 2002:a17:902:d04a:b0:1ac:5b6b:df4c with SMTP id l10-20020a170902d04a00b001ac5b6bdf4cmr8789233pll.69.1684755264868; Mon, 22 May 2023 04:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684755264; cv=none; d=google.com; s=arc-20160816; b=x6jjrOPd+MXK46mT4yiIoRNDYwxipqMRG71nj4G3im+iM7s72sO4EWuaR5J/9+qlwC XufXDQ3gDJ00hw1QmE7y5JUy7jqwJeIf/lisIvV6fnaiq7VOZ0iqR1ll8x/C2HtRHXRy APotFKtN7uOrHamPQ5XWxxObZL4U2fzi+VXyW8sTPb0t1K9PvJ3DRtQPIC94URKzsYu9 BzUGfv7Slc6C/4hwLPHt3+0fM3HtEPoIgtpGgNRPyi/XDWI9Yp6rgs4w+aVc1J5xek1l izRn4TBqxEn5EdghMljv4CxSYcyboLQ5lnuYHe5WTFhxJW4yuNHJACX+8P048gQ5p6K/ gmHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=JtdmhQrWCFQED7VOg3cXi10j0gVoa/bMjFtzex/rw04=; b=WoFb5bIumtvqqN3FFJdm9gty+dOLMvCyUSbmpbSunplApFX75PpyMcDmRMT4O6IAM+ Vgl35KPqY4pPzlD2qot6isbu1S0YTEjNW7kC8YqS35fTfPhad73AHetXh3y0vxeV55Ap PsfvEUYQb/aQCWg72aD2ot4aDDDSwcMTuGRcs+gHacPLtseP5paV01FgIH5Fnyop4Z5R i09aGMWh8ltccNBmHTdpRRQBSbsVga9dYcv7/M5Nzj5mabr6EN909VPgaWX8df4KmF/8 Nhd876JymngqoYBdYK2k6dyja6bAeZnHUzxFyQR2iNu60gw+KFZMniKn5/aZyplJCdlT gj7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wYAfpowm; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170902ec8200b001afbb27f554si889471plg.623.2023.05.22.04.34.12; Mon, 22 May 2023 04:34:24 -0700 (PDT) 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=@linux.dev header.s=key1 header.b=wYAfpowm; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233199AbjEVL03 (ORCPT + 99 others); Mon, 22 May 2023 07:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbjEVL0I (ORCPT ); Mon, 22 May 2023 07:26:08 -0400 Received: from out-53.mta0.migadu.com (out-53.mta0.migadu.com [IPv6:2001:41d0:1004:224b::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E259E46 for ; Mon, 22 May 2023 04:23:59 -0700 (PDT) Message-ID: <8f6057b5-362b-a0f6-2f2f-579debe48fce@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1684754637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JtdmhQrWCFQED7VOg3cXi10j0gVoa/bMjFtzex/rw04=; b=wYAfpowmOB5btaCjRmN8Sbm4SWX9btJYILcEd+yKi4rcVWdQqHQKAsOgkCwGNwoRxDBGu3 JmI6XP14fHq4euszyA6RqP6axEylSWCsRjucnhVhe/Ev5CnEsc3vtEHsxvoBX/Iv5bPzT1 gdJQ8jKnE3czkHPnEU5nFLolhY8qCvI= Date: Mon, 22 May 2023 19:23:41 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 05/31] mm/filemap: allow pte_offset_map_lock() to fail Content-Language: en-US To: Hugh Dickins , Andrew Morton Cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <68a97fbe-5c1e-7ac6-72c-7b9c6290b370@google.com> <3e6d4f8-9f4d-fa7e-304e-1494dddd45b@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: <3e6d4f8-9f4d-fa7e-304e-1494dddd45b@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 2023/5/22 12:54, Hugh Dickins wrote: > filemap_map_pages() allow pte_offset_map_lock() to fail; and remove the > pmd_devmap_trans_unstable() check from filemap_map_pmd(), which can safely > return to filemap_map_pages() and let pte_offset_map_lock() discover that. > > Signed-off-by: Hugh Dickins > --- > mm/filemap.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index 28b42ee848a4..9e129ad43e0d 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -3408,13 +3408,6 @@ static bool filemap_map_pmd(struct vm_fault *vmf, struct folio *folio, > if (pmd_none(*vmf->pmd)) > pmd_install(mm, vmf->pmd, &vmf->prealloc_pte); > > - /* See comment in handle_pte_fault() */ > - if (pmd_devmap_trans_unstable(vmf->pmd)) { > - folio_unlock(folio); > - folio_put(folio); > - return true; > - } > - > return false; > } > > @@ -3501,6 +3494,11 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, > > addr = vma->vm_start + ((start_pgoff - vma->vm_pgoff) << PAGE_SHIFT); > vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, addr, &vmf->ptl); > + if (!vmf->pte) { > + folio_unlock(folio); > + folio_put(folio); Missing: ret = VM_FAULT_NOPAGE; ? > + goto out; > + } > do { > again: > page = folio_file_page(folio, xas.xa_index); -- Thanks, Qi