From nobody Fri Dec 19 04:14:25 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CFEC1B6554 for ; Thu, 29 Aug 2024 16:57:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724950672; cv=none; b=DbgpcMAHMMHkyV7pcYNPM7TsXzqTgkOB6fQA6rokyV5TRZfZPqgrSKRofdnOjkxKqhC0zE/nu/GfA5uws6RcWDTv6rXQ3Gr2BxRlmVt75SVDsqfy3I7R7qnIezA6kZmquQ1uW9lJgoxX9sfr/5K8nJjl4LQheV5AuXLgMPh5NaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724950672; c=relaxed/simple; bh=YgSN2WU8YPPe3BIrmNuupjxgq4wOpkUDRF97fLPgncA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tXz/99rPhZBBbJQLdP5hseLaghExMMJgnPPJx6YyebpLwunjcBVUE7XaNkMYSZv4qA42HqciNt64YCTz+Je5CYSH364Eyui0MKN+xw8gNrfSxqUf4690cldi+VhhsmnLXYD2ZGW6E92lwpi2eZLNCrTBLkpe086b8GlfMwsUKjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YxTIiV4C; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YxTIiV4C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724950670; 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=UQpm0aZ+NCHrJn7YVxv+CdOsqon69CXtB9EHB2F3FEM=; b=YxTIiV4CT6G7xXJqhcX/bYldPMDxnwXpm5YXVcJiXcaaIn1SVscl9GBfwLRSJyK22qoVnM jyiL8WAsPh+yWevsXxJYEHxXNFbUawriLQRZrkwIuydOu5nt610JEm/vkpqXZ/qhNkNghm /2TdfEwmIx8YpbWuxwULikVSfiQmHf4= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-AymGZyrrMjyz7mijX24iug-1; Thu, 29 Aug 2024 12:57:44 -0400 X-MC-Unique: AymGZyrrMjyz7mijX24iug-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 402891913791; Thu, 29 Aug 2024 16:57:41 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.193.245]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3B8C51955DC0; Thu, 29 Aug 2024 16:57:32 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, x86@kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , "Matthew Wilcox (Oracle)" , Tejun Heo , Zefan Li , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Jonathan Corbet , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: [PATCH v1 06/17] mm/rmap: pass vma to __folio_add_rmap() Date: Thu, 29 Aug 2024 18:56:09 +0200 Message-ID: <20240829165627.2256514-7-david@redhat.com> In-Reply-To: <20240829165627.2256514-1-david@redhat.com> References: <20240829165627.2256514-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" We'll need access to the destination MM when modifying the total mapcount of a non-hugetlb large folios next. So pass in the VMA. Signed-off-by: David Hildenbrand --- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 6594c122a5895..ee1bff1638f90 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1153,8 +1153,8 @@ int pfn_mkclean_range(unsigned long pfn, unsigned lon= g nr_pages, pgoff_t pgoff, } =20 static __always_inline unsigned int __folio_add_rmap(struct folio *folio, - struct page *page, int nr_pages, enum rmap_level level, - int *nr_pmdmapped) + struct page *page, int nr_pages, struct vm_area_struct *vma, + enum rmap_level level, int *nr_pmdmapped) { atomic_t *mapped =3D &folio->_nr_pages_mapped; const int orig_nr_pages =3D nr_pages; @@ -1314,7 +1314,7 @@ static __always_inline void __folio_add_anon_rmap(str= uct folio *folio, =20 VM_WARN_ON_FOLIO(!folio_test_anon(folio), folio); =20 - nr =3D __folio_add_rmap(folio, page, nr_pages, level, &nr_pmdmapped); + nr =3D __folio_add_rmap(folio, page, nr_pages, vma, level, &nr_pmdmapped); =20 if (likely(!folio_test_ksm(folio))) __page_check_anon_rmap(folio, page, vma, address); @@ -1480,7 +1480,7 @@ static __always_inline void __folio_add_file_rmap(str= uct folio *folio, =20 VM_WARN_ON_FOLIO(folio_test_anon(folio), folio); =20 - nr =3D __folio_add_rmap(folio, page, nr_pages, level, &nr_pmdmapped); + nr =3D __folio_add_rmap(folio, page, nr_pages, vma, level, &nr_pmdmapped); __folio_mod_stat(folio, nr, nr_pmdmapped); =20 /* See comments in folio_add_anon_rmap_*() */ --=20 2.46.0