From patchwork Thu Aug 29 16:56:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13783459 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CE8EC87FC3 for ; Thu, 29 Aug 2024 16:57:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 172586B0099; Thu, 29 Aug 2024 12:57:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1222E6B009A; Thu, 29 Aug 2024 12:57:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2B626B009B; Thu, 29 Aug 2024 12:57:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D223B6B0099 for ; Thu, 29 Aug 2024 12:57:52 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9DEE51206D9 for ; Thu, 29 Aug 2024 16:57:52 +0000 (UTC) X-FDA: 82505889984.02.0C507F5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id EED3180012 for ; Thu, 29 Aug 2024 16:57:50 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YxTIiV4C; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724950650; a=rsa-sha256; cv=none; b=YVeb3wVJdsz+wyyy6CkeL6NN7e3BA8z8/tmcPHbu62za64QD3bK14qfsxepqcwlHeiPZV4 NAXVBvHeZGE1XKcyWYd10pjhOPTeyP7nE1xth4Wk/XHx4JqAaV6OkAzfjBfiNFeIRQyARi ULaorORFldr8hQWnY+S+adS3BpyQ/ls= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YxTIiV4C; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724950650; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UQpm0aZ+NCHrJn7YVxv+CdOsqon69CXtB9EHB2F3FEM=; b=CWqoFjJgSuIiGBUIggjnBHmOIso6U0oSjMD6gxC+ep4aUx5iK5JzL67HrIYqDB04r3zVTA kLlDjT07XwSlS7xeLsKSEmivHuHmo0Oklymh+4zZPsq82cmolT2EQxdCgW1WDBzBlKoOeF w1ccuziKcSVACspu3E1/if/ZBtFntz8= 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_Koutn=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> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Rspamd-Queue-Id: EED3180012 X-Rspamd-Server: rspam01 X-Stat-Signature: oss83tjz77zk6t7hpcmx38mojpw3wwdx X-HE-Tag: 1724950670-635197 X-HE-Meta: U2FsdGVkX19mYJ6bUr5gMbUxBUhA0KWz3F3uSpwudSFGEZIL5VVKcqkL75RD9dpRUUxjGHLgGemAcQkmOTUbvmqq6K1JwI7MAKZ/4PTdYbCe7kVtj5yVc9Q0HBgTVeQhlElVTpMHZ4o1Fm1hDn6zYbK7gPLEo2n7VcKQRZmGwi7p9QhthtCwNKXuaJmw3hNxvife/7MLs86ROMQhzbqLARIQuku6v9to2HxXNg5EK68qSO/Xvfk6zocPrZx3fIwStRz1q++1MuK4H2HsrL8weM2lXQdx4S9VMfTkoCgXNnnum7fXJP2XmOKUc5me9nZJwPAPC2EaLu/sgvP6j3Rais2pBoVhJnamevhisfByVEgZJZsqTex3P4E7bEXdp+WWCFGz11XVgK0d9qpkMVdwkxkBttfwfZq8FOD1JKCpka2bcXHtz1Mbn2qVhwONFXW7VMa7veXG89xA0xsZX8ywVB1l1mnckZ326B3CpInpibhyqyvX+F8EkOU5aaIS9UFiV1Sk2O7S8+pVAp2GtmGVBkilkQmM5bx2TLmGhEtJLuoQZayT5a8XnVIzzrk9G/IUSYhOK5C0MJ2Y9vYeaIFnfLAHneyX7rkGL6qOv/7xClsnIc434WnHR7g2uL9ukWuiAkJaSt3+EBuKAcoOtyegDWC4HFRzByqoU9+p1pcyHJhrLqWJmcAfexGhtqysmGLF31JNZb+dtEBmNSEOacon/n5z/dldR4BIJH++Ap02Ql+Tz/39H1JBEwgsJW6D7tt2DwD8OmPncu+iADPK3SpccxP28OKGK7qhLszOXemL6TV1lPo8CXvzTS8VC0Eu5gIJMCu/mnhYkDYTVYkbFuyIVzHl1UnMgYPeSWYH1/6LakCosielh8XULWCPUlQo6z3vDjWrKIVhj4/tEKSP3BtCTxnNwkDifWA2UNWopPc1cwrcq7BDIEVzb3A2Lv6KPJacfiQn9g+i63/7IJ6XhGW 6jpAol9S 2GulGxUFkrf8XjRDYDR2PnMni9FYWW9R/5LlgyZEhWY5utdzAuh1F6eodgb5Iwz/WsYoI/oGi7U1Vtk1HfvIBeoHNIIcOrnnBjJpRSPwQXY1aPrhSFcJpWQG8XbAsflHelNw0UZ8f97m0nKfi90YX0RL3nbq7Blj7elMK7K22g16zkfUuxstbW/fxlUgViBEw6D9bKCmS15ULw7o4+mo6WsMRSb5omDpGJ3yHgcVMuw6agi/2QgJ5dIRgknowfojLST51xoLppa320ugnXwpP0rkmWrJzyvDxo8bXkwu0ubPAPUd8LnifHRCYM/ruTgwLFE/2kCMGS/VvJIYSQGuMpNi7Erw6prFYEg/SSq4cjX2EUdS5/rbNrsyOWA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 long nr_pages, pgoff_t pgoff, } 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 = &folio->_nr_pages_mapped; const int orig_nr_pages = nr_pages; @@ -1314,7 +1314,7 @@ static __always_inline void __folio_add_anon_rmap(struct folio *folio, VM_WARN_ON_FOLIO(!folio_test_anon(folio), folio); - nr = __folio_add_rmap(folio, page, nr_pages, level, &nr_pmdmapped); + nr = __folio_add_rmap(folio, page, nr_pages, vma, level, &nr_pmdmapped); 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(struct folio *folio, VM_WARN_ON_FOLIO(folio_test_anon(folio), folio); - nr = __folio_add_rmap(folio, page, nr_pages, level, &nr_pmdmapped); + nr = __folio_add_rmap(folio, page, nr_pages, vma, level, &nr_pmdmapped); __folio_mod_stat(folio, nr, nr_pmdmapped); /* See comments in folio_add_anon_rmap_*() */