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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B05C001B3 for ; Mon, 3 Jul 2023 17:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbjGCRcx (ORCPT ); Mon, 3 Jul 2023 13:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjGCRcw (ORCPT ); Mon, 3 Jul 2023 13:32:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A65D4E5D for ; Mon, 3 Jul 2023 10:32:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 443DD60FF1 for ; Mon, 3 Jul 2023 17:32:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F72C433C8; Mon, 3 Jul 2023 17:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1688405570; bh=D8g8MRhsacpgYdP9qWz/dA+j/xyI7k75Ui+gu2nYrnI=; h=Date:To:From:Subject:From; b=rlqlwa5gJnKoII9Qxns8zdzyGLTgZVMQi9F6Hzf5Do+ECRxYGKtT3Nxf4U0bJIGCJ GUr5OtDLWRrQE4lszMII5RrukzVF+2+3ech1IpHfMgRh7ngRUsKH/4/83//FRq9msk uqbLqNle1X5iafJBcHCa9YWBscfusfRL/5kSYN78= Date: Mon, 03 Jul 2023 10:32:49 -0700 To: mm-commits@vger.kernel.org, zhangpeng362@huawei.com, willy@infradead.org, sidhartha.kumar@oracle.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-memory-convert-do_page_mkwrite-to-use-folios.patch added to mm-unstable branch Message-Id: <20230703173250.91F72C433C8@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm/memory: convert do_page_mkwrite() to use folios has been added to the -mm mm-unstable branch. Its filename is mm-memory-convert-do_page_mkwrite-to-use-folios.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory-convert-do_page_mkwrite-to-use-folios.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Sidhartha Kumar Subject: mm/memory: convert do_page_mkwrite() to use folios Date: Sun, 2 Jul 2023 22:58:47 -0700 Saves one implicit call to compound_head(); Link: https://lkml.kernel.org/r/20230703055850.227169-1-sidhartha.kumar@oracle.com Signed-off-by: Sidhartha Kumar Cc: Matthew Wilcox Cc: ZhangPeng Signed-off-by: Andrew Morton --- mm/memory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/mm/memory.c~mm-memory-convert-do_page_mkwrite-to-use-folios +++ a/mm/memory.c @@ -2933,7 +2933,7 @@ static gfp_t __get_fault_gfp_mask(struct static vm_fault_t do_page_mkwrite(struct vm_fault *vmf) { vm_fault_t ret; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); unsigned int old_flags = vmf->flags; vmf->flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE; @@ -2948,14 +2948,14 @@ static vm_fault_t do_page_mkwrite(struct 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)) { + folio_unlock(folio); return 0; /* retry */ } ret |= VM_FAULT_LOCKED; } else - VM_BUG_ON_PAGE(!PageLocked(page), page); + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); return ret; } _ Patches currently in -mm which might be from sidhartha.kumar@oracle.com are mm-increase-usage-of-folio_next_index-helper.patch mm-memory-convert-do_page_mkwrite-to-use-folios.patch mm-memory-convert-wp_page_shared-to-use-folios.patch mm-memory-convert-do_shared_fault-to-folios.patch mm-memory-convert-do_read_fault-to-use-folios.patch