From nobody Sun Feb 8 15:58:48 2026 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 DDA5F187848 for ; Mon, 29 Jul 2024 18:39:13 +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=1722278355; cv=none; b=PdvpFMqsArBZQW7CXpj4VO2RVgJ1tS3Cq+HNRt+e3RBxiyMzyRFR0lEVg9eApaye6UHAIQRpfDd4+xDSZ5GIGNypi6BQw7LzaT+kclujcN9QLvdlxj31i780bhmCq1yGOm86KX8s4P51RkQvCzG7jc35bKQ1upNbtrbq4/gKqiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722278355; c=relaxed/simple; bh=CuI3A3UP7rCuy25/6pPJiotF95Rkz1Dr1he2WDJI2ac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HFMYA8yyNlWERgCEWPX3AdifWFXcXgTy3m1z7V21kc03+cEFiAxtzNUsUNorNfELY4ActVdSB98cvKwcGzsbGi1hRpGSY4Y3yLZT4x4rThkQR4USPr/LZGHqGwVV3Jgn14VD5Y6mSkbXOW2/b1uXO+3db9klxnQAVscJORYNgYk= 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=gggzIkAs; 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="gggzIkAs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722278353; 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=1LweK4YyrJ+GH/WLrm8oiFvHfSVbn4+ENVtw/AVp5dM=; b=gggzIkAsWZ3waP+b3d6i3vm8xaWbVj1zB7SRP73Fy98aT9oQR3tbSrhWjGF3LZv/HIn7zq XDj9OV6N+gxJTDmC9B1RYu9sgtTN1C7oBiQlXjFVfsnEKhmqD5zo2fcOwF3CmhA7LrvCJw BAp0H1AF1aq1rSR17G1b/g6J5P6aEKo= Received: from mx-prod-mc-05.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-673-8Qug9MJyOh6RXOQYIceWMA-1; Mon, 29 Jul 2024 14:39:09 -0400 X-MC-Unique: 8Qug9MJyOh6RXOQYIceWMA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B279A1955F49; Mon, 29 Jul 2024 18:39:07 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5CA481955D45; Mon, 29 Jul 2024 18:38:59 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Andrew Morton , Matthew Wilcox , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Janosch Frank , Claudio Imbrenda Subject: [PATCH v1 1/3] mm: simplify arch_make_folio_accessible() Date: Mon, 29 Jul 2024 20:38:42 +0200 Message-ID: <20240729183844.388481-2-david@redhat.com> In-Reply-To: <20240729183844.388481-1-david@redhat.com> References: <20240729183844.388481-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.15 Content-Type: text/plain; charset="utf-8" Now that s390x implements HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE, let's turn generic arch_make_folio_accessible() into a NOP: there are no other targets that implement HAVE_ARCH_MAKE_PAGE_ACCESSIBLE but not HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE. Signed-off-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Vishal Moola (Oracle) --- include/linux/mm.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 381750f41767a..bab689ec77f94 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2215,16 +2215,7 @@ static inline int arch_make_page_accessible(struct p= age *page) #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE static inline int arch_make_folio_accessible(struct folio *folio) { - int ret; - long i, nr =3D folio_nr_pages(folio); - - for (i =3D 0; i < nr; i++) { - ret =3D arch_make_page_accessible(folio_page(folio, i)); - if (ret) - break; - } - - return ret; + return 0; } #endif =20 --=20 2.45.2 From nobody Sun Feb 8 15:58:48 2026 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 07B94188CB8 for ; Mon, 29 Jul 2024 18:39:19 +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=1722278361; cv=none; b=n0lRnzPFV/uGLYRyGr5w2rdg8FRmOPHOqMPSFYzFOyIdHru2nndcYmmYE2v2bpAwE45JjzQhxmYwBYbcYVTAcKMZOfQbdKCmhsCIIvKHoZSXEmHR8mz4Fh6okUHHdKpim70hLaQ1HE+4HZFSUd39u72pNhdWXXdd+iyCR8f4sz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722278361; c=relaxed/simple; bh=WS1XPhQwnhOA8zYMUiuwouo9AFcA8auwgelO1865fr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RlmrSMCUayNWyIMQSco9FZ5oZpLwS0UCntmkxOkvcXk2JATDDsd8NmcaaGqz5jan/jXzIEo7ROi9yGmI7lWDE1UX7X3pj9UkbJxDyeC92el75SkDqCiOGBOBNFdmwvM1f180OMdsfO53bjzrbqyalAzL7jhX0mgU24r4L89LtI4= 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=a2yH0TZu; 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="a2yH0TZu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722278359; 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=exvRAG2tHq6VgTaD/fmuS7ZLph4K5zUJO/hhwy+FasE=; b=a2yH0TZuQ6hg4tyFJV5lmTKiV+gCvMBdyAh5DSIlR1QiChtsYglk+P9cJ6aNiw5SsdNVq0 jfiC32+sX0NsTJzW8M+kLnbSSf6rThvhzQKjCgOT7SGB6BpOJz8RZhwjTsLa7JTtaXPXz0 in5L9iD8Uwkpwo0egsH66KM2l0gIVMo= Received: from mx-prod-mc-03.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-157-8rBTIKH0MemeRNuEhQNSCw-1; Mon, 29 Jul 2024 14:39:15 -0400 X-MC-Unique: 8rBTIKH0MemeRNuEhQNSCw-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FB9A1956064; Mon, 29 Jul 2024 18:39:13 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 079E61955D45; Mon, 29 Jul 2024 18:39:07 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Andrew Morton , Matthew Wilcox , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Janosch Frank , Claudio Imbrenda Subject: [PATCH v1 2/3] mm/gup: convert to arch_make_folio_accessible() Date: Mon, 29 Jul 2024 20:38:43 +0200 Message-ID: <20240729183844.388481-3-david@redhat.com> In-Reply-To: <20240729183844.388481-1-david@redhat.com> References: <20240729183844.388481-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.15 Content-Type: text/plain; charset="utf-8" Let's use arch_make_folio_accessible() instead so we can get rid of arch_make_page_accessible(). Signed-off-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Vishal Moola (Oracle) --- mm/gup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 120740cf5a348..3e8484c893aa8 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -819,6 +819,7 @@ static struct page *follow_page_pte(struct vm_area_stru= ct *vma, struct dev_pagemap **pgmap) { struct mm_struct *mm =3D vma->vm_mm; + struct folio *folio; struct page *page; spinlock_t *ptl; pte_t *ptep, pte; @@ -876,6 +877,7 @@ static struct page *follow_page_pte(struct vm_area_stru= ct *vma, goto out; } } + folio =3D page_folio(page); =20 if (!pte_write(pte) && gup_must_unshare(vma, flags, page)) { page =3D ERR_PTR(-EMLINK); @@ -886,7 +888,7 @@ static struct page *follow_page_pte(struct vm_area_stru= ct *vma, !PageAnonExclusive(page), page); =20 /* try_grab_folio() does nothing unless FOLL_GET or FOLL_PIN is set. */ - ret =3D try_grab_folio(page_folio(page), 1, flags); + ret =3D try_grab_folio(folio, 1, flags); if (unlikely(ret)) { page =3D ERR_PTR(ret); goto out; @@ -898,7 +900,7 @@ static struct page *follow_page_pte(struct vm_area_stru= ct *vma, * Documentation/core-api/pin_user_pages.rst for details. */ if (flags & FOLL_PIN) { - ret =3D arch_make_page_accessible(page); + ret =3D arch_make_folio_accessible(folio); if (ret) { unpin_user_page(page); page =3D ERR_PTR(ret); @@ -2919,7 +2921,7 @@ static int gup_fast_pte_range(pmd_t pmd, pmd_t *pmdp,= unsigned long addr, * details. */ if (flags & FOLL_PIN) { - ret =3D arch_make_page_accessible(page); + ret =3D arch_make_folio_accessible(folio); if (ret) { gup_put_folio(folio, 1, flags); goto pte_unmap; --=20 2.45.2 From nobody Sun Feb 8 15:58:48 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 A296E187324 for ; Mon, 29 Jul 2024 18:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722278368; cv=none; b=Yu4tPfgqf1hxIju4DRiV2YXc7ov8/ZgyffcfA4hEWbIOkdDtikl+xyD2bYOrDbyQUaHHzereZrzzMZolM8uwKVBiCbcDiPH95Q7oPQ031+BE7EcYLJ8Txmhq46QhI/1ReRRou0M1o0TJAo72131y0u2gGLRByLcz8/bTz+pClHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722278368; c=relaxed/simple; bh=xk3+KuScjITGXiDzDjfIu4gA/sRyc3tOmEiEhe4VNEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=afbMeNOVb2dCM+JMylRG2GkBqqrc0OXDlLabuUtDCFcwn5fen+l6UqDoRbjhHMwvgRYJ3QTzWHtQ5svBBHlmqszGfw8I7kLcrk1WKqkybB+4FXfCMpDJpYpqfB62NZFj6ATCB/deHcE+zSlzu43IVEJx80V6rosVUUhZwGZhRug= 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=IygY/Gtm; arc=none smtp.client-ip=170.10.133.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="IygY/Gtm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722278365; 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=9H38+PlxDPb0B2kVTxHGHrLppqPJ/7ePtq7mF29j+5Q=; b=IygY/GtmzREHBpA/meZVg2ei5jRiXlWgEtRHV47efLqrSB5ytxtbzWw5q548yNwTiwtGta RvUpovQnQzHJkr/Mb5zLpd4GSIB6r5jOiT2ENKmtuzn3qn1YtdAd7ordpfU16lKROxm6fI HyNC7CDV1mNR2LdbhNi8vgvEm4lotr4= Received: from mx-prod-mc-05.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-274-TyEAJ39yMBCJknv_CsRGMA-1; Mon, 29 Jul 2024 14:39:22 -0400 X-MC-Unique: TyEAJ39yMBCJknv_CsRGMA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C61E19560A1; Mon, 29 Jul 2024 18:39:19 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5EF6D1955D42; Mon, 29 Jul 2024 18:39:13 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Andrew Morton , Matthew Wilcox , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Janosch Frank , Claudio Imbrenda Subject: [PATCH v1 3/3] s390/uv: drop arch_make_page_accessible() Date: Mon, 29 Jul 2024 20:38:44 +0200 Message-ID: <20240729183844.388481-4-david@redhat.com> In-Reply-To: <20240729183844.388481-1-david@redhat.com> References: <20240729183844.388481-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.15 Content-Type: text/plain; charset="utf-8" All code was converted to using arch_make_folio_accessible(), let's drop arch_make_page_accessible(). Signed-off-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Vishal Moola (Oracle) --- arch/s390/include/asm/page.h | 2 -- arch/s390/kernel/uv.c | 5 ----- include/linux/mm.h | 7 ------- 3 files changed, 14 deletions(-) diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index 06416b3f94f59..515db8241eb6b 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h @@ -176,8 +176,6 @@ static inline int devmem_is_allowed(unsigned long pfn) =20 int arch_make_folio_accessible(struct folio *folio); #define HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE -int arch_make_page_accessible(struct page *page); -#define HAVE_ARCH_MAKE_PAGE_ACCESSIBLE =20 struct vm_layout { unsigned long kaslr_offset; diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index 36db065c7cf75..35ed2aea88918 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -548,11 +548,6 @@ int arch_make_folio_accessible(struct folio *folio) } EXPORT_SYMBOL_GPL(arch_make_folio_accessible); =20 -int arch_make_page_accessible(struct page *page) -{ - return arch_make_folio_accessible(page_folio(page)); -} -EXPORT_SYMBOL_GPL(arch_make_page_accessible); static ssize_t uv_query_facilities(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { diff --git a/include/linux/mm.h b/include/linux/mm.h index bab689ec77f94..07b478952bb02 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2205,13 +2205,6 @@ static inline bool folio_likely_mapped_shared(struct= folio *folio) return atomic_read(&folio->_mapcount) > 0; } =20 -#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE -static inline int arch_make_page_accessible(struct page *page) -{ - return 0; -} -#endif - #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE static inline int arch_make_folio_accessible(struct folio *folio) { --=20 2.45.2