Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp23237323rwd; Fri, 30 Jun 2023 21:23:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlE6AV14kAwzPi4WrDtfd2caaGmq31ac2kDSujsVbuMqDb4S65c7j4lSYaoU9hmBy6CBA5f4 X-Received: by 2002:a25:bb4c:0:b0:ba1:d8a6:d2b2 with SMTP id b12-20020a25bb4c000000b00ba1d8a6d2b2mr3961921ybk.7.1688185428995; Fri, 30 Jun 2023 21:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688185428; cv=none; d=google.com; s=arc-20160816; b=yOAOBNbvjC1OU0irjTWruz24P2dE2NkKDJrUoXnDGkTTXcHduiV1Xjbhbv/Wm5PqCo oozVKY1ALhl2mc2ajfHVLFxU/d/LP7/+s+zPCAK+qeDAb6dVZxV31r0rwlGPMlI57vk2 yu+i/mIzqS50JuCqlHEWtbsHWDs9zC/d/9N0kTYm18MmcmC4AZg8VXFVe7hAuuOxL6jh pXy5GKYvFKM8CqJhFp+eR14FyWktRhIXTBupvzzbiiSjUv1xM4TTL/OuK6xF9f8219jp qAdK9ala847qEwdPcQg1i0rSZkweCvJG7oEL4rUXUU2jqqSjnjizOHFw4uXXbJL7I9oX GB0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hrDDcmHnpynXqyvywojhzhzT6+fSNeluiHTRPRkvoKM=; fh=sseU4O+oqopp12EPmhxR3nh+ngQh6y4sT1gRFnXeDhs=; b=xlIuHla3ibVuKlts3m0hDxSDqdJFPEsACrs24CpAYcR707Nt8/hzYK0Ja/K0nYFdKF KgY4TuLDVcanmGoxpvLqT7DKvOHkJYCFr6FwaHMkoUxKWW2DwC7HNBDO71Nh+wagZQNA GkmSO5WhULS7ZoNH7RbtaNiV9slPgx0SnSCxw9hy82h0Gg7ZIbWRzhxt0mvRXkX5vXsQ PjrJQJotTjQ0Uh4bADmO+iCV7+hWC90Xfb5quOucuDV5EYZjk9fSf50lfAdHhlg/kBqj tVd/MbkcmxjJbf46IzByyWpw4QVpqnmI36W79jK4mcVSQvVswrqOtXycX/MFywEmFxRn kq0Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a656207000000b00524ecfa05d8si14670420pgv.15.2023.06.30.21.23.28; Fri, 30 Jun 2023 21:23:48 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjGADga (ORCPT + 99 others); Fri, 30 Jun 2023 23:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbjGADer (ORCPT ); Fri, 30 Jun 2023 23:34:47 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBEE297C for ; Fri, 30 Jun 2023 20:29:02 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QtHfh1HWqzLn4k; Sat, 1 Jul 2023 11:26:52 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 1 Jul 2023 11:28:59 +0800 From: Peng Zhang To: , , , CC: , , , ZhangPeng Subject: [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page() Date: Sat, 1 Jul 2023 11:28:52 +0800 Message-ID: <20230701032853.258697-2-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230701032853.258697-1-zhangpeng362@huawei.com> References: <20230701032853.258697-1-zhangpeng362@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 From: ZhangPeng We can replace four implicit calls to compound_head() with one by using folio. Signed-off-by: ZhangPeng Reviewed-by: Sidhartha Kumar --- mm/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 765e5d8ed1f4..9a2f4dab872f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2968,20 +2968,20 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct address_space *mapping; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); bool dirtied; bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite; - dirtied = set_page_dirty(page); - VM_BUG_ON_PAGE(PageAnon(page), page); + dirtied = folio_mark_dirty(folio); + VM_BUG_ON_FOLIO(folio_test_anon(folio), folio); /* - * Take a local copy of the address_space - page.mapping may be zeroed - * by truncate after unlock_page(). The address_space itself remains - * pinned by vma->vm_file's reference. We rely on unlock_page()'s + * Take a local copy of the address_space - folio.mapping may be zeroed + * by truncate after folio_unlock(). The address_space itself remains + * pinned by vma->vm_file's reference. We rely on folio_unlock()'s * release semantics to prevent the compiler from undoing this copying. */ - mapping = page_rmapping(page); - unlock_page(page); + mapping = folio_raw_mapping(folio); + folio_unlock(folio); if (!page_mkwrite) file_update_time(vma->vm_file); -- 2.25.1