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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10988C433DB for ; Sat, 26 Dec 2020 21:09:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB2D52184D for ; Sat, 26 Dec 2020 21:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726046AbgLZVIQ (ORCPT ); Sat, 26 Dec 2020 16:08:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgLZVIO (ORCPT ); Sat, 26 Dec 2020 16:08:14 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0321DC061757 for ; Sat, 26 Dec 2020 13:07:33 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id h22so16000422lfu.2 for ; Sat, 26 Dec 2020 13:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=N6fEfq+jWauozbcMHPf/B0M4w8Cb6kqr3VPP7Q+3/4QNRt+Netvh3QJmjtws1fK7sj SLs93EdyJRwwErvnET7KD+AF9lnNMk7UFHq2G7xO97r/ulDnrwYmuUUpcMLSiJJNLzHx Fexyl7FzYf0NKSWDJXi29vPxcqWkkF8u2MRX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=LWDiZ57wgFQ/1vViV5EziFUeU5ZqF0oVGWTtLVKt/u16Wx2ljKyhJW+E5huOs4dWYj wGoepA1nt+xDyyesdNSg49RFClaI6NiQAFSXNWl+z8lefL0OEwQJUjM+QXlu3+UJTW3p yjElhACn/zaI74322kh1ONsr6CLHhTYqvftvIgZd2DR7B4h6dhDoJL+PNxUvhKhcslEf yHLExX8bbVpQXAngZWzaHGtsW2cuIeXFSh667bQQdsMe3zt6zIX4sbP+EFa3IFqJ3IRP R0xA5wVj0f4Pf9CWGqELUonYh13mb6kDWl3IqRGIYgUaND/EH6ytRiERE6DPabyRyCX2 d+WA== X-Gm-Message-State: AOAM531eQ3QQcdgn1zJbYrFNd/NWnXjrwkgBoUIMNpPZBH0TtRECMf5x WmxsjnAwKhFp7kpwflkXae4QU6HWol1Sgg== X-Google-Smtp-Source: ABdhPJzTGGu17cFe8YG62BrApp39ghJzVEyJ8rKhRqAV1agh0hOpKNdXE57nLNS0T+OW6Hw3XNMxzw== X-Received: by 2002:a19:86c1:: with SMTP id i184mr15508170lfd.563.1609016851846; Sat, 26 Dec 2020 13:07:31 -0800 (PST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id o138sm4362604lfa.171.2020.12.26.13.07.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Dec 2020 13:07:31 -0800 (PST) Received: by mail-lf1-f46.google.com with SMTP id m12so15926158lfo.7 for ; Sat, 26 Dec 2020 13:07:30 -0800 (PST) X-Received: by 2002:a19:7d85:: with SMTP id y127mr17054973lfc.253.1609016850481; Sat, 26 Dec 2020 13:07:30 -0800 (PST) MIME-Version: 1.0 References: <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> <20201222100047.p5zdb4ghagncq2oe@box> <20201225113157.e7hmluffh56fszfc@box> <20201226204335.dikqkrkezqet6oqf@box> In-Reply-To: <20201226204335.dikqkrkezqet6oqf@box> From: Linus Torvalds Date: Sat, 26 Dec 2020 13:07:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" Cc: Hugh Dickins , Matthew Wilcox , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , Vinayak Menon , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I was going to just apply this patch, because I like it so much, but then I decided to take one last look, and: On Sat, Dec 26, 2020 at 12:43 PM Kirill A. Shutemov wrote: > > +static bool filemap_map_pmd(struct vm_fault *vmf, struct page *page) > +{ > + struct mm_struct *mm = vmf->vma->vm_mm; > + > + /* Huge page is mapped? No need to proceed. */ > + if (pmd_trans_huge(*vmf->pmd)) > + return true; doesn't this cause us to leak a locked page? I get the feeling that every single "return true" case here should always unlock the page and - with the exception of a successful do_set_pmd() - do a "put_page()". Which kind of argues that we should just do it in the caller (and get an extra ref in the do_set_pmd() case, so that the caller can always do if (filemap_map_pmd(..)) { unlock_page(page); put_page(page); rcu_read_unlock(); return; } andf then there are no odd cases inside that filemap_map_pmd() function. Hmm? Other than that, I really find it all much more legible. Of course, if I'm wrong about the above, that just proves that I'm missing something and it wasn't so legible after all.. Linus 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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06B0CC433DB for ; Sat, 26 Dec 2020 21:07:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F74021D7A for ; Sat, 26 Dec 2020 21:07:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F74021D7A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D3AF88D0092; Sat, 26 Dec 2020 16:07:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEA5D8D0080; Sat, 26 Dec 2020 16:07:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDA028D0092; Sat, 26 Dec 2020 16:07:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id A44FD8D0080 for ; Sat, 26 Dec 2020 16:07:34 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6A4E6180AD81F for ; Sat, 26 Dec 2020 21:07:34 +0000 (UTC) X-FDA: 77636669628.15.fan77_611186f27485 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 464281814B0C1 for ; Sat, 26 Dec 2020 21:07:34 +0000 (UTC) X-HE-Tag: fan77_611186f27485 X-Filterd-Recvd-Size: 5413 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Sat, 26 Dec 2020 21:07:33 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 23so15881515lfg.10 for ; Sat, 26 Dec 2020 13:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=N6fEfq+jWauozbcMHPf/B0M4w8Cb6kqr3VPP7Q+3/4QNRt+Netvh3QJmjtws1fK7sj SLs93EdyJRwwErvnET7KD+AF9lnNMk7UFHq2G7xO97r/ulDnrwYmuUUpcMLSiJJNLzHx Fexyl7FzYf0NKSWDJXi29vPxcqWkkF8u2MRX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=CWsi0oDb+ijf1d9Guf/BcCTgzfPLv+6Z/W7E/k4Vx8tkAlF384fkWxHpLS7Mqng31g /iyyBq0KOfbAcWI8p9j0joC5rrgxnok12J3I4hxsWSWSBe6n3h4/O2nOx/gtfHvsCbmF Q6kFOx+3gg+Cui2E/3cxrIPAifXrmDSTQw55FyLWRb2o+BxHQCz2fKrCFPk0f0B7w0Zo JYdEJiMUavzVYa3KwBNgN4DiCeCfvqvTSz336NUZ7orxuyRMh+t5AmmaCkNHK00CdVz9 1bClOQ0o+9iuAbctqixP6Siscb0VgVPI6eeHzBCtXSg8m8ZzoYX04hzpFmtpaq2dTMEr mZNw== X-Gm-Message-State: AOAM532Hh1z9b6p8o/vunhe93hl/RQz1KwP/U6SLy4iiKTINsu/QUYH7 jgHFwrvNnDEdl3JmyfkR4qAwWJs+B6BCmw== X-Google-Smtp-Source: ABdhPJymtSOaoDqK/bYGZt0DcSO7uK0rTuR9j33eyKoQlYQG+YKeLyBZE4GmQ4ZK8tRUrKLnLc+zjg== X-Received: by 2002:a2e:9d8e:: with SMTP id c14mr17798199ljj.7.1609016851888; Sat, 26 Dec 2020 13:07:31 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id l84sm4741498lfd.75.2020.12.26.13.07.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Dec 2020 13:07:31 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id x20so15868257lfe.12 for ; Sat, 26 Dec 2020 13:07:30 -0800 (PST) X-Received: by 2002:a19:7d85:: with SMTP id y127mr17054973lfc.253.1609016850481; Sat, 26 Dec 2020 13:07:30 -0800 (PST) MIME-Version: 1.0 References: <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> <20201222100047.p5zdb4ghagncq2oe@box> <20201225113157.e7hmluffh56fszfc@box> <20201226204335.dikqkrkezqet6oqf@box> In-Reply-To: <20201226204335.dikqkrkezqet6oqf@box> From: Linus Torvalds Date: Sat, 26 Dec 2020 13:07:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" Cc: Hugh Dickins , Matthew Wilcox , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , Vinayak Menon , Android Kernel Team Content-Type: text/plain; charset="UTF-8" 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: I was going to just apply this patch, because I like it so much, but then I decided to take one last look, and: On Sat, Dec 26, 2020 at 12:43 PM Kirill A. Shutemov wrote: > > +static bool filemap_map_pmd(struct vm_fault *vmf, struct page *page) > +{ > + struct mm_struct *mm = vmf->vma->vm_mm; > + > + /* Huge page is mapped? No need to proceed. */ > + if (pmd_trans_huge(*vmf->pmd)) > + return true; doesn't this cause us to leak a locked page? I get the feeling that every single "return true" case here should always unlock the page and - with the exception of a successful do_set_pmd() - do a "put_page()". Which kind of argues that we should just do it in the caller (and get an extra ref in the do_set_pmd() case, so that the caller can always do if (filemap_map_pmd(..)) { unlock_page(page); put_page(page); rcu_read_unlock(); return; } andf then there are no odd cases inside that filemap_map_pmd() function. Hmm? Other than that, I really find it all much more legible. Of course, if I'm wrong about the above, that just proves that I'm missing something and it wasn't so legible after all.. Linus 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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED07CC433E0 for ; Sat, 26 Dec 2020 21:09:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99D162184D for ; Sat, 26 Dec 2020 21:09:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99D162184D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=m3J3P0AVP7pRpmrqJ+Q9t5VvHus66BXFRX6N8n9VD7w=; b=Z/fAiGa/8nT3e8Is23/paaQGr zgG/LClsgSoHPOCE/XoC/m+OZRwI5UpSgCK5eYeJBuuSQ8cevT190gL+DqOty9kbwWmWPw7qzrqBM B6A+Qi1Eg9KdcbDDgPPI6QQdV3dQ9qeMHCHFmWn27/UZdGqsru0OktqehcqhUOqHjQOuqJvDM0bDq mL8Gn5duDjsZ56u6xMoQEFsuw8lhZ1uO2NJEyDlRFMFpSx9EbYb2bUBs5TX5uridxJJGLlY5FPrtO knXGUSMrI2PCcsZXysRtw49GNdjnZIt3/yuBUn6j4cvNCmJpRlZUeYQH35nj0LtnGqSOeMTlS5nKA croYcJ+Pg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktGmo-0005Nu-QP; Sat, 26 Dec 2020 21:07:38 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktGmm-0005Mk-28 for linux-arm-kernel@lists.infradead.org; Sat, 26 Dec 2020 21:07:37 +0000 Received: by mail-lf1-x12d.google.com with SMTP id h22so16000471lfu.2 for ; Sat, 26 Dec 2020 13:07:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=N6fEfq+jWauozbcMHPf/B0M4w8Cb6kqr3VPP7Q+3/4QNRt+Netvh3QJmjtws1fK7sj SLs93EdyJRwwErvnET7KD+AF9lnNMk7UFHq2G7xO97r/ulDnrwYmuUUpcMLSiJJNLzHx Fexyl7FzYf0NKSWDJXi29vPxcqWkkF8u2MRX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TLzZOIgPa8iJ9Qz8oeEG2djATaWpwCUP0i8Tl1Hc7Zg=; b=PZlcnXbSKkgL4pZI4pC5gEzc3TrRpl0UqmhExsaPzCWCoX60loSuMlwUCvycloY1Wd ZrxFr1gul8VVGEEOlYTRr0PrvQB4wGqTj16Z4cQnritLk5j2C02nR8DBgj4wy3JddamT nhyZs9fw9fu5PGxeNUzMFKMt0FVZL1SiTSKlJ6tFxeKhJjLWAKCz5ITPQzjVc097KtXw vaWFRDYgQB3bb2Nrqj/m2me+Nt4fBH/C+4HtrFSjz54dgB2rZmhQ5c+fPRNcYmtXR3/w FCfYG4ktg16XqFefWkxJJQcwIWN0sfj2xZw6wQ0m2NN8FZmUrUujdRPjH38bstz2ihKU MBzQ== X-Gm-Message-State: AOAM530ZhY3OZrSxB1QtUylJOnDs/V8H8T+qu039VN6YUAHcejxuk0Zw cr+bib5F4VBeluFjD2xjlc2ZU4XJmSYo8Q== X-Google-Smtp-Source: ABdhPJzY8gLRs6mX25keY4DQR9UoRLaNbjTo46D1saR4luiLfqxuT2rhaqU5RSO96uMH7YAhdhm6RA== X-Received: by 2002:a05:651c:1b2:: with SMTP id c18mr19385341ljn.385.1609016852490; Sat, 26 Dec 2020 13:07:32 -0800 (PST) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id c10sm5452837lji.103.2020.12.26.13.07.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Dec 2020 13:07:31 -0800 (PST) Received: by mail-lf1-f52.google.com with SMTP id o17so15951787lfg.4 for ; Sat, 26 Dec 2020 13:07:30 -0800 (PST) X-Received: by 2002:a19:7d85:: with SMTP id y127mr17054973lfc.253.1609016850481; Sat, 26 Dec 2020 13:07:30 -0800 (PST) MIME-Version: 1.0 References: <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> <20201222100047.p5zdb4ghagncq2oe@box> <20201225113157.e7hmluffh56fszfc@box> <20201226204335.dikqkrkezqet6oqf@box> In-Reply-To: <20201226204335.dikqkrkezqet6oqf@box> From: Linus Torvalds Date: Sat, 26 Dec 2020 13:07:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201226_160736_127680_741F6196 X-CRM114-Status: GOOD ( 14.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Android Kernel Team , Jan Kara , Minchan Kim , Catalin Marinas , Hugh Dickins , Linux Kernel Mailing List , Matthew Wilcox , Linux-MM , Vinayak Menon , Linux ARM , Andrew Morton , Will Deacon , "Kirill A. Shutemov" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I was going to just apply this patch, because I like it so much, but then I decided to take one last look, and: On Sat, Dec 26, 2020 at 12:43 PM Kirill A. Shutemov wrote: > > +static bool filemap_map_pmd(struct vm_fault *vmf, struct page *page) > +{ > + struct mm_struct *mm = vmf->vma->vm_mm; > + > + /* Huge page is mapped? No need to proceed. */ > + if (pmd_trans_huge(*vmf->pmd)) > + return true; doesn't this cause us to leak a locked page? I get the feeling that every single "return true" case here should always unlock the page and - with the exception of a successful do_set_pmd() - do a "put_page()". Which kind of argues that we should just do it in the caller (and get an extra ref in the do_set_pmd() case, so that the caller can always do if (filemap_map_pmd(..)) { unlock_page(page); put_page(page); rcu_read_unlock(); return; } andf then there are no odd cases inside that filemap_map_pmd() function. Hmm? Other than that, I really find it all much more legible. Of course, if I'm wrong about the above, that just proves that I'm missing something and it wasn't so legible after all.. Linus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel