Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26898231rwd; Mon, 3 Jul 2023 17:12:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGT4yTYcTGwdpfRuh9Rqmuj8rtp/tR9NNxJ/8NMUeGmfk8ECXeeg4tqsdnovfFC0X8w/NNK X-Received: by 2002:a17:90a:154f:b0:263:21d6:906b with SMTP id y15-20020a17090a154f00b0026321d6906bmr11601915pja.14.1688429538426; Mon, 03 Jul 2023 17:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688429538; cv=none; d=google.com; s=arc-20160816; b=Wpg+ejBGXrwlFWUd/F3BX5ey8+XQAezQAZqVpA/57yFqpkKVGnK0s0nXDemsru1Llu mIKFyzbigF8d0+JJ/c3E3XVjoBFj9Y6lfzm0fVmkVwL6z1Z5X6lipFczjNrFWABqxt2f IkPiq6KGrbQwM5x1d3xfM/3JQ7XTFqvFO+hSBRIbiqNxr6SBhQgfNcdRKFQXiFCt6Tg2 jbpkyK8KiHQTQbPhcWh5cRGNeINqlD+qow5ftsj6fDkNpywX4wHJrq3+9T5HK8L/dzIx Rv6ewd40P5HolGqpt/a6xvbsy3yr/VpCEqO/GVjaaJvXZOl9hgUQqO/UPmqYSJKXNDKR HK3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r6NW5ob5nydgft1g4tMd/ZQ4GrO0FPkqE43DiG6awyM=; fh=XLJLg8WXdhwGrMSzs3MfkZczrcBsqkmvHzzfT+Z54/s=; b=JBWCyfrVJpOvRDL02f0jG2JiEhgJ2otyq7pqigtkWmQMKKvU9sFrqlbVuvIE6cWQ/t +d3C7Z5A9KbSqPjWG0Xtwi1k9SYGBoZUbpZmr/3p93KCM7kOzlOoxBAJnaPgtxzcjSxM Sdr/SOAjSfEWPcoxqLiHDZOwb3TVFvFcX9Kmvz0y4ltX+fSRin885dWhffDCaCT/WK6x aeh2doYz2c2erPOOGexDYR4c1WGFXIk08zagqwGaPR45zVNBYjXHcbfiGTGohmSY2R5a tTvgb9wRfe2ed45VhcIET3RZkJuO+ukh6n4hMlHnyTVEhrIx9nLpjy/gS1FHHebbo8ys bxsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=EEr+L4w4; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b005573ea6ead9si20115642pge.306.2023.07.03.17.12.05; Mon, 03 Jul 2023 17:12:18 -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=@infradead.org header.s=casper.20170209 header.b=EEr+L4w4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjGCXZi (ORCPT + 99 others); Mon, 3 Jul 2023 19:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjGCXZh (ORCPT ); Mon, 3 Jul 2023 19:25:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6649BEA for ; Mon, 3 Jul 2023 16:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=r6NW5ob5nydgft1g4tMd/ZQ4GrO0FPkqE43DiG6awyM=; b=EEr+L4w47VF/MNPkmxdmKRs/xt NFuVkNRnV3/7y2/8pClxkZMTOVVDlVaSku51V+RGR8tqhxJMfx06bmBJmgsI+ei/5Sn/plZxu9v9k AmAqxgMmuCDmdov9TfXMeclIdlwWrRwvKmajaeu20K9kSirPhszzcaDdr9U+zIJEEbPIhOnQo/YgY vsqy1lqMjdtY8e9DzG2gvE2PHSN5REV/0BhMjxXl3u/j1Rgh0ETjjO2ioPkcsOua128pGjuQ7kY/l b1H25oFALLQdC3ERb1K1tHCo7W98yGI4Yh9vUbqG8I12MuPv8BruItqmHYxZRSWcHUTv51y62cEV1 1I9BeEBg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qGSvF-008cjd-37; Mon, 03 Jul 2023 23:25:33 +0000 Date: Tue, 4 Jul 2023 00:25:33 +0100 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org Subject: Re: [PATCH 1/4] mm/memory: convert do_page_mkwrite() to use folios Message-ID: References: <20230703055850.227169-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703055850.227169-1-sidhartha.kumar@oracle.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 Sun, Jul 02, 2023 at 10:58:47PM -0700, Sidhartha Kumar wrote: > @@ -2947,14 +2947,14 @@ static vm_fault_t do_page_mkwrite(struct vm_fault *vmf) > if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) > return ret; > if (unlikely(!(ret & VM_FAULT_LOCKED))) { > - lock_page(page); > - if (!page->mapping) { > - unlock_page(page); > + folio_lock(folio); > + if (!folio_mapping(folio)) { You don't need to call folio_mapping() here. folio->mapping works absolutely fine in this circumstance. In fact, you may have broken a driver with this change. I can elaborate more, but I'm not quite in the mood to do that right now.