Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1461436rdb; Mon, 2 Oct 2023 10:07:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELK142mGtbpR8S6SBpwF9I7YVjgMXHOyPBFbkWSL0XY052Xyl1qoh1/u+CiL4SGS2OT8Ls X-Received: by 2002:a05:6870:ea81:b0:1c8:b715:6c81 with SMTP id s1-20020a056870ea8100b001c8b7156c81mr13358157oap.55.1696266444500; Mon, 02 Oct 2023 10:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696266444; cv=none; d=google.com; s=arc-20160816; b=CBcG08TDJGTOqebRBRI6G2EEWlMa83az0QhShMIFuV9iCXIaK+5toqCjkmXpjTH0g2 GVXfI2E26ZKhr+E7mT93aEMnFnnnCJf3idt4362x5YcfL5Ui+slLC+TKAxjtHBATQsV/ c7AmKBJ/7bPywmt00i8Vjl0AwFY+qcj3tGivHjewbxwClt+pRRwhN414OVTDrRfNuR3D 53EfYkbd5+R3hOcEd33KtBnw1ejOkf7a+bCVtoFw14BpXhasyRMnWoNYqMX/O2r+RinM w0L9rAo+U7Z9fRh+e7gSqSaGcFJf4F4JAYRq21Ci8vREGcWuH2PRYFcA9f8xWv+J3Hpg cQvQ== 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 :dkim-signature; bh=iuOLWxV07WMAFicgIRp5L49gcu/vw0Qb9ZJxOn72iWI=; fh=9zMraF9xqB+ji/y8otbFQF1V52x00H8qsdWu3Nrm/O0=; b=wlKsrde181I3wvHEy/guT6bwdnbwgdLrmKRNU1HxurcDfk+MWfD8FXwD8QwbbZOph9 R9Mgkquh0tec2TEQ8HERCuQalEnf1+QbNiv1OjhThld7RBpwb4Y6elqCrcdR/6hLy1G8 f0QEqJP4Ii03xQcR7X4oiD4NHfQS0sT5e/1Y/H6MXAHxAJsZToEmvp9uJybQFabGVNxU MSmeL6+OhucTQl/d/igImfEl2Ve8gBGcRS2ZCD9HTKKTVvvKBtYF1QT5+KsEsGMov4W6 wxxVb7RbKH6IImFTrCh1Zqw6MHNrjQyY4q1xiJY/D+GgE0zgUsaNIuiqCK10AAAbki2w Qhrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rp5mwb27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00563deb65f93si26607807pgb.200.2023.10.02.10.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 10:07:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rp5mwb27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3AEB6805D3B4; Mon, 2 Oct 2023 07:30:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237747AbjJBOah (ORCPT + 99 others); Mon, 2 Oct 2023 10:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237639AbjJBOag (ORCPT ); Mon, 2 Oct 2023 10:30:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32A2B4 for ; Mon, 2 Oct 2023 07:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696256998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iuOLWxV07WMAFicgIRp5L49gcu/vw0Qb9ZJxOn72iWI=; b=Rp5mwb27nYLeg/ebKD8hUPPEEqGAh7M8PnrgvsHCCLasadeMTcKs+opWXHRbmeIVaRSgdE RKoOeLcW4Wvjsr/nufhf8jb+7isNJrCw3GksEfIQJKl9v/bZc2O/8y1hX3dLHXApReTaX4 cJ6sRzEiboU/KZOpilrmTWHJOy6m0eQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-A63WA2viPemAtiRYluLjVw-1; Mon, 02 Oct 2023 10:29:54 -0400 X-MC-Unique: A63WA2viPemAtiRYluLjVw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26B71802C1A; Mon, 2 Oct 2023 14:29:54 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.194.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09C2510EE6CE; Mon, 2 Oct 2023 14:29:52 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Mike Kravetz , Muchun Song , Suren Baghdasaryan Subject: [PATCH v1 2/3] mm/rmap: convert page_move_anon_rmap() to folio_move_anon_rmap() Date: Mon, 2 Oct 2023 16:29:48 +0200 Message-ID: <20231002142949.235104-3-david@redhat.com> In-Reply-To: <20231002142949.235104-1-david@redhat.com> References: <20231002142949.235104-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 07:30:57 -0700 (PDT) Let's convert it to consume a folio. Signed-off-by: David Hildenbrand --- include/linux/rmap.h | 2 +- mm/huge_memory.c | 2 +- mm/hugetlb.c | 2 +- mm/memory.c | 2 +- mm/rmap.c | 16 +++++++--------- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 064b432a4033..8034eda972e5 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -194,7 +194,7 @@ typedef int __bitwise rmap_t; /* * rmap interfaces called when adding or removing pte of page */ -void page_move_anon_rmap(struct page *, struct vm_area_struct *); +void folio_move_anon_rmap(struct folio *, struct vm_area_struct *); void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long address, rmap_t flags); void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 01d0d65ece13..08245226ccb8 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1505,7 +1505,7 @@ vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf) if (folio_ref_count(folio) == 1) { pmd_t entry; - page_move_anon_rmap(page, vma); + folio_move_anon_rmap(folio, vma); SetPageAnonExclusive(page); folio_unlock(folio); reuse: diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 24591fc145ff..e52c6048e74f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5461,7 +5461,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, */ if (folio_mapcount(old_folio) == 1 && folio_test_anon(old_folio)) { if (!PageAnonExclusive(&old_folio->page)) { - page_move_anon_rmap(&old_folio->page, vma); + folio_move_anon_rmap(old_folio, vma); SetPageAnonExclusive(&old_folio->page); } if (likely(!unshare)) diff --git a/mm/memory.c b/mm/memory.c index 9de231c92769..1f0e3317cbdd 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3483,7 +3483,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) * and the folio is locked, it's dark out, and we're wearing * sunglasses. Hit it. */ - page_move_anon_rmap(vmf->page, vma); + folio_move_anon_rmap(folio, vma); SetPageAnonExclusive(vmf->page); folio_unlock(folio); reuse: diff --git a/mm/rmap.c b/mm/rmap.c index 854ccbd66954..37f05f33559b 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1141,19 +1141,17 @@ int folio_total_mapcount(struct folio *folio) } /** - * page_move_anon_rmap - move a page to our anon_vma - * @page: the page to move to our anon_vma - * @vma: the vma the page belongs to + * folio_move_anon_rmap - move a folio to our anon_vma + * @page: The folio to move to our anon_vma + * @vma: The vma the folio belongs to * - * When a page belongs exclusively to one process after a COW event, - * that page can be moved into the anon_vma that belongs to just that - * process, so the rmap code will not search the parent or sibling - * processes. + * When a folio belongs exclusively to one process after a COW event, + * that folio can be moved into the anon_vma that belongs to just that + * process, so the rmap code will not search the parent or sibling processes. */ -void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma) +void folio_move_anon_rmap(struct folio *folio, struct vm_area_struct *vma) { void *anon_vma = vma->anon_vma; - struct folio *folio = page_folio(page); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); VM_BUG_ON_VMA(!anon_vma, vma); -- 2.41.0