From nobody Fri Dec 19 18:27:44 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 A94094A35 for ; Sun, 30 Mar 2025 12:17:37 +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=1743337059; cv=none; b=QXMLpikDX6N0ICuUmN030MJ3Sxg5YzmIyUJ9KSVfaFZdUmrhB17D3c6+2EoyW6/kbxEq/ekpz++sUN+zVCwdyJMNbP9jvUD5s+9uPIBmonKCs+7dIf/dYgq+QEALv67ukW2jbnVuJvfCmcuE8RwSBi+qIMaNvzGtFhysgHoAB6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337059; c=relaxed/simple; bh=4jBP70Y+7GsAX14XssyUY9Y02msmYk6bryg0MZHnSqc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=pXKNhIgxBnqorWakQJIKvyYAvxhXOnC8ErVsdOheN3i6htduYCssQPmlw1UHronb5NwJ843pvZO1TFH94x+ngnVXih68qvgy9XEFdCO45EK3OpOYXrTq+d44+SE020tgsMhZpVf2OQqupOzvsQA2X123AA+2lWhGwlk4jM4WKJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=iw/UC6xR; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="iw/UC6xR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=66JPNi1zYSbyVc7TO8PPyR6Yrn7uiScYJyyuaMI/UWs=; b=iw/UC6xRQ4LAhmdLHzeSEslZC0Fl7n6/vrfx2/JjjiNI/DtQOnIRPwI78ryuFkTf6n3Xcj ZTUGDmyMyTV1NIuhZBYimCp7ycCH77LLr6riDFSljM8XzvRNsiUxpNddW74UHdY5tauEen eWrHr5hJPqMq0kDLpye44MLjb4/fMq8= 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-207-vuwXJPkUN92ViNpZjUnXmw-1; Sun, 30 Mar 2025 08:17:31 -0400 X-MC-Unique: vuwXJPkUN92ViNpZjUnXmw-1 X-Mimecast-MFC-AGG-ID: vuwXJPkUN92ViNpZjUnXmw_1743337050 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 992B5195E92A; Sun, 30 Mar 2025 12:17:30 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E5C71801750; Sun, 30 Mar 2025 12:17:25 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 1/7] mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable() Date: Sun, 30 Mar 2025 20:17:11 +0800 Message-ID: <20250330121718.175815-2-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Not like fault_in_writeable() or fault_in_writeable(), in fault_in_safe_writeable() local variable 'start' is increased page by page to loop till the whole address range is handled. However, it mistakenly calcalates the size of handled range with 'uaddr - start'. Fix it here. Signed-off-by: Baoquan He --- mm/gup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 855ab860f88b..73777b1de679 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2207,8 +2207,8 @@ size_t fault_in_safe_writeable(const char __user *uad= dr, size_t size) } while (start !=3D end); mmap_read_unlock(mm); =20 - if (size > (unsigned long)uaddr - start) - return size - ((unsigned long)uaddr - start); + if (size > start - (unsigned long)uaddr) + return size - (start - (unsigned long)uaddr); return 0; } EXPORT_SYMBOL(fault_in_safe_writeable); --=20 2.41.0 From nobody Fri Dec 19 18:27:44 2025 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 AEBBB1BE251 for ; Sun, 30 Mar 2025 12:17:40 +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=1743337062; cv=none; b=QeXLyKp+dC+XD+Kf2mzYYrAYxNLhXbC+0dc1F2+1zimjWj9ODuTp1Uc69tswP/VmhRTDT5Iwu3LJPYvijAAahSbVSkK1tpXCcIlAdwyM67mAi/bwiLHJgUiRLO7Z0hI/cX8RRJBlfUWXBZr9FN47+lNLnD1eDVxX5m5A+16t3Jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337062; c=relaxed/simple; bh=Ng+GNrybUdI+BpZ9b0iCGTWyUpXKBhvvQS92NmSnUkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=fyftU0UCMP9kY0ecAdGwL+IedXXfu3/IWH9g5SrMM30pF1J3R2cWaB1LmYkdIf6+xT+58/iX7L9iab+taVtcIph1JhMkxdy8o6Zd9LzeQnSNIosOD6oakgkZpcLR0GL2fOeMFygvvGjoM/7OsAABX3BejsEXLitArh6pIiC0REM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=b6RLiTQz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="b6RLiTQz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0G+7enjJ3hUuHc8nn+ZMKDLjMZiATmJ3BHld8fzSZf8=; b=b6RLiTQz+MLGUMzHB1mQfKDhOShYRsK6a0vOEvkdfewN7t63f9KrkPpzqDQmUPBgdCg2rd wUxzqAv9hLNAlJrwIrwsO6eBIAQvFueHnlIfR1VuPj7JJu8V3VkYo8o9LWgd0UAT8PgPBj 4VrTmsJpg6WmxFsMwMSONT3FOK6vbRU= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-fhcRkH7YOYeKvg-myRGkUg-1; Sun, 30 Mar 2025 08:17:36 -0400 X-MC-Unique: fhcRkH7YOYeKvg-myRGkUg-1 X-Mimecast-MFC-AGG-ID: fhcRkH7YOYeKvg-myRGkUg_1743337055 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0173E18004A9; Sun, 30 Mar 2025 12:17:35 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BD13180094A; Sun, 30 Mar 2025 12:17:31 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 2/7] mm/gup: check if both GUP_GET and GUP_PIN are set in __get_user_pages() earlier Date: Sun, 30 Mar 2025 20:17:12 +0800 Message-ID: <20250330121718.175815-3-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" In __get_user_pages(), it will traverse page table and take a reference to the page the given user address corresponds to if GUP_GET or GUP_PIN is et. However, it's not supported both GUP_GET and GUP_PIN are set. This check should be done earlier, but not doing it till entering into follow_page_pte() and failed. Here move the checking to the beginning of __get_user_pages(). Signed-off-by: Baoquan He --- mm/gup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 73777b1de679..8788105daee8 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -847,11 +847,6 @@ static struct page *follow_page_pte(struct vm_area_str= uct *vma, pte_t *ptep, pte; int ret; =20 - /* FOLL_GET and FOLL_PIN are mutually exclusive. */ - if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) =3D=3D - (FOLL_PIN | FOLL_GET))) - return ERR_PTR(-EINVAL); - ptep =3D pte_offset_map_lock(mm, pmd, address, &ptl); if (!ptep) return no_page_table(vma, flags, address); @@ -1434,6 +1429,11 @@ static long __get_user_pages(struct mm_struct *mm, =20 VM_BUG_ON(!!pages !=3D !!(gup_flags & (FOLL_GET | FOLL_PIN))); =20 + /* FOLL_GET and FOLL_PIN are mutually exclusive. */ + if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) =3D=3D + (FOLL_PIN | FOLL_GET))) + return ERR_PTR(-EINVAL); + do { struct page *page; unsigned int page_increm; --=20 2.41.0 From nobody Fri Dec 19 18:27:44 2025 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 57D8D1CDFCE for ; Sun, 30 Mar 2025 12:17:41 +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=1743337063; cv=none; b=knVYhsV0GGYdNboA60vMp6zf8o8zYw7SlGx2bOc7wmpp+GyJqqpgVQnoUA+U+U2DGRsKEX/Xh6SazBXYxZTiIhSWAtfP9Z+8wz6LOorNsUqHfqMJAVTO30xPb5HL0aKbwhcWA4lfK1LEGgfjqou+hmgrHG1YPSZBDXN6UmhH/bI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337063; c=relaxed/simple; bh=gKdhX4jI7FvUr3w6tNdE00UAASTxwhzzmxFRJbbPJgo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=p8ZQ0Zirud9RzJXubPLqUJFZ/CrYIWU6w7Vbw7FwbIIC5l2N5y7md9Z2fw6QzhVaN//U9pR/egWRlk4o5721fF+7RgTiYwDMAxv3RiToogAmvTFvrj8P8aZ8CPmmWjpgNL3z3lB/DRBYpqChAcIFP7SR9VLE0xduWdVDRu8+QI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=NI6i1+be; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="NI6i1+be" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7LqQOrccmB1vzyfnAtlatGcQGL//TNrd+LmFWKgXy5M=; b=NI6i1+betIgdO1fQ15s3NHiYItbx88NC2Bo8et0+ewGzlVvh/IiL96D0CdUyceW6VGk8ql jQdkMnJUrAZvoinoQtsl3XDjxmT4eHBzTdi+lUwyr2JVQtLmOy20YrVtr4GafT6Q+tAQLQ L/Xxjlv2OB95kTTZJFY5Pv5x81DeIzQ= Received: from mx-prod-mc-02.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-14-LJRw6BwZMB2lZhSVeFH_uQ-1; Sun, 30 Mar 2025 08:17:39 -0400 X-MC-Unique: LJRw6BwZMB2lZhSVeFH_uQ-1 X-Mimecast-MFC-AGG-ID: LJRw6BwZMB2lZhSVeFH_uQ_1743337058 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FFEF19560AF; Sun, 30 Mar 2025 12:17:38 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CEE2B180094A; Sun, 30 Mar 2025 12:17:35 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 3/7] mm/gup: Fix the outdated code comments above get_user_pages_unlocked() Date: Sun, 30 Mar 2025 20:17:13 +0800 Message-ID: <20250330121718.175815-4-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Since commit f0818f472d8d ("mm: gup: add get_user_pages_locked and get_user_pages_unlocked"), get_user_pages() doesn't need to have mmap_lock held anymore. It calls __get_user_pages_locked() which can acquire and drop the mmap_lock internaly. Hence remove the incorrect code comments now. Signed-off-by: Baoquan He --- mm/gup.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 8788105daee8..3345a065c2cb 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2702,19 +2702,9 @@ long get_user_pages(unsigned long start, unsigned lo= ng nr_pages, EXPORT_SYMBOL(get_user_pages); =20 /* - * get_user_pages_unlocked() is suitable to replace the form: - * - * mmap_read_lock(mm); - * get_user_pages(mm, ..., pages, NULL); - * mmap_read_unlock(mm); - * - * with: - * - * get_user_pages_unlocked(mm, ..., pages); - * - * It is functionally equivalent to get_user_pages_fast so - * get_user_pages_fast should be used instead if specific gup_flags - * (e.g. FOLL_FORCE) are not required. + * get_user_pages_unlocked() is functionally equivalent to + * get_user_pages_fast so get_user_pages_fast should be used instead + * if specific gup_flags (e.g. FOLL_FORCE) are not required. */ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags) --=20 2.41.0 From nobody Fri Dec 19 18:27:44 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 8331A155333 for ; Sun, 30 Mar 2025 12:17:48 +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=1743337070; cv=none; b=M0mO1MUVMGtOhltRnKg0bjH6HcNJRGVXCx77KaVw7Rh9X2D79G0Ouv5cvrNgJRuF5HBS53EN0jH/1ypjJu+WzFuLQwtTvT/dlcbUsVusdtoM64AawL/U/WpleCYGPKu6jJ4wMfwrlAW40Cx0QlQ8pyYI8J+nrCccMDIqFaxxXN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337070; c=relaxed/simple; bh=sNo71/UwJJrOsGQDRP85vpICwpdHE7BULlIn/TDNp10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=AswiccR63tuMTVYtm53Vs8i64QSJW+SJpF5xNXijkFAIVqSJLVjYlOUqk4zO3xsrCcflOaF6lgoJ7pXk+2pWBs9qEdvcSCjwAU/Favih3+DTCQswzk6gKYj5tSjiF+9cRASNALHpvdYCbGcm3dfHXquixrNGYaHnRpG5A0U6SQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=SBWCTnW1; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="SBWCTnW1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hxqDMoJetNer7F1DwMLPFhLQrU8sSqdg39HX8cZyX4Y=; b=SBWCTnW1iM2ul+g6V3EgV3mt54ZfoUrAWkRxsrSzR+8ccObDxQYqyvY5Vj3g74ohwxMtlH oE630Qc5BoOYGkhZeb2NArnAWkrusfaW0/zA23FnqPjY0EGIy/oZxBrbSgtIEpBo7NHJWs aED3mP56knpo4BYQvMZzJyF3laWVkuo= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-371-Zv7FARzWNZOEPs16cB8FOQ-1; Sun, 30 Mar 2025 08:17:43 -0400 X-MC-Unique: Zv7FARzWNZOEPs16cB8FOQ-1 X-Mimecast-MFC-AGG-ID: Zv7FARzWNZOEPs16cB8FOQ_1743337062 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 200B31800266; Sun, 30 Mar 2025 12:17:42 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 630CE180094A; Sun, 30 Mar 2025 12:17:38 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 4/7] mm/gup: remove gup_fast_pgd_leaf() and clean up the relevant codes Date: Sun, 30 Mar 2025 20:17:14 +0800 Message-ID: <20250330121718.175815-5-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" In the current kernel, only pud huge page is supported in some architectures. P4d and pgd huge pages haven't been supported yet. And in mm/gup.c, there's no pgd huge page handling in the follow_page_mask() code path. Hence it doesn't make sense to have gup_fast_pgd_leaf() in gup_fast code path. Here remove gup_fast_pgd_leaf() and clean up the relevant codes. Signed-off-by: Baoquan He --- mm/gup.c | 49 +++---------------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 3345a065c2cb..3d2c57f59b4d 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3168,46 +3168,6 @@ static int gup_fast_pud_leaf(pud_t orig, pud_t *pudp= , unsigned long addr, return 1; } =20 -static int gup_fast_pgd_leaf(pgd_t orig, pgd_t *pgdp, unsigned long addr, - unsigned long end, unsigned int flags, struct page **pages, - int *nr) -{ - int refs; - struct page *page; - struct folio *folio; - - if (!pgd_access_permitted(orig, flags & FOLL_WRITE)) - return 0; - - BUILD_BUG_ON(pgd_devmap(orig)); - - page =3D pgd_page(orig); - refs =3D record_subpages(page, PGDIR_SIZE, addr, end, pages + *nr); - - folio =3D try_grab_folio_fast(page, refs, flags); - if (!folio) - return 0; - - if (unlikely(pgd_val(orig) !=3D pgd_val(*pgdp))) { - gup_put_folio(folio, refs, flags); - return 0; - } - - if (!pgd_write(orig) && gup_must_unshare(NULL, flags, &folio->page)) { - gup_put_folio(folio, refs, flags); - return 0; - } - - if (!gup_fast_folio_allowed(folio, flags)) { - gup_put_folio(folio, refs, flags); - return 0; - } - - *nr +=3D refs; - folio_set_referenced(folio); - return 1; -} - static int gup_fast_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned long end, unsigned int flags, struct page **pages, int *nr) @@ -3302,12 +3262,9 @@ static void gup_fast_pgd_range(unsigned long addr, u= nsigned long end, next =3D pgd_addr_end(addr, end); if (pgd_none(pgd)) return; - if (unlikely(pgd_leaf(pgd))) { - if (!gup_fast_pgd_leaf(pgd, pgdp, addr, next, flags, - pages, nr)) - return; - } else if (!gup_fast_p4d_range(pgdp, pgd, addr, next, flags, - pages, nr)) + BUILD_BUG_ON(pgd_leaf(pgd)); + if (!gup_fast_p4d_range(pgdp, pgd, addr, next, flags, + pages, nr)) return; } while (pgdp++, addr =3D next, addr !=3D end); } --=20 2.41.0 From nobody Fri Dec 19 18:27:44 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 70F1A19004B for ; Sun, 30 Mar 2025 12:17:49 +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=1743337071; cv=none; b=pmvZgfLcDogbSkp5GKYNM1ER911zSXzUfl/16pT6pAMAxr/K/Jtr3YobxxQka+6LGIbSxuMdA7NGBzED8vG4F7UWmDL0dlnG80hXdnZIMIKTK1jfV4NVQLW8BdBcZHALLlga9UEN6O8KchEAESJO+Pr2r+eDSuAlEr5DHNQcmEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337071; c=relaxed/simple; bh=8WbuReWn74hBEr1o+VvrMN/f//G44Uk2QZXGIXOHYww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=mpaI0f6nwF+hcnI0YVAPNkjvoByt4daLXYJoWDKCVx5Bo+2aLBgninMA7luC1awRk4ElUZhpxmwxZ0Jp4WMN+rNzrldELYZpem8HhlE6hFHFchlWCLZemppYLW6nNdIhCz5ZCj1CFTS9sYvgxUc/1r2SI0O1Zx8xwTYESTRvaAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=G5F3o4FC; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="G5F3o4FC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ECEhQdPvPexYB/Ok4Vzz5g2XDSSP0HaL/jTvOM1baE=; b=G5F3o4FCkwDUtQOV38YKkT08MXde0vvqMi2RvvbnyBqnW92bw7Bgvvzzx+EufaTb4bTOak L8BuyL7II0YwgM0OW3jadx68i1XlqjFyPYMbyykKiK2ioP9AmaNxHxIalhSwHri2gJjDmG H8ITzQacoXjbOzdTR8XPc56tClXKsk4= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541-SWtT2QNYNkS5LbpE4fkmHA-1; Sun, 30 Mar 2025 08:17:46 -0400 X-MC-Unique: SWtT2QNYNkS5LbpE4fkmHA-1 X-Mimecast-MFC-AGG-ID: SWtT2QNYNkS5LbpE4fkmHA_1743337065 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A71F11809CA3; Sun, 30 Mar 2025 12:17:45 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0F745180094A; Sun, 30 Mar 2025 12:17:42 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 5/7] x86/mm: remove pgd_leaf definition in arch Date: Sun, 30 Mar 2025 20:17:15 +0800 Message-ID: <20250330121718.175815-6-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" pgd huge page is not supported yet, let's use the generic definition in linux/pgtable.h. And also update the BUILD_BUG_ON() checking for pgd_leaf() in pti_user_pagetable_walk_p4d() because pgd_leaf() returns boolean value. Signed-off-by: Baoquan He --- arch/x86/include/asm/pgtable.h | 3 --- arch/x86/mm/pti.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 7bd6bd6df4a1..5f4fcc0eea17 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1472,9 +1472,6 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } =20 -#define pgd_leaf pgd_leaf -static inline bool pgd_leaf(pgd_t pgd) { return false; } - #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION /* * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 p= ages diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 5f0d579932c6..c2e1de40136f 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -185,7 +185,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long= address) =20 set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page))); } - BUILD_BUG_ON(pgd_leaf(*pgd) !=3D 0); + BUILD_BUG_ON(pgd_leaf(*pgd)); =20 return p4d_offset(pgd, address); } --=20 2.41.0 From nobody Fri Dec 19 18:27:44 2025 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 485CC1CD205 for ; Sun, 30 Mar 2025 12:17:55 +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=1743337077; cv=none; b=KjRvL1wygC9P0YH4J9ARvg9vwylAvC+/Zz8CzBeT0iDRND6VBP/k3zLJAJFscEEoHKrAhpk+Cnq7GCSDUjEGiSqzfac+CyLcft69+w2Mv84PMhZKflqU31zu66J4ygURLA0uP1o1dOW4DFvIVW48YdnrEV8RblI0wnFLiUVwl28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337077; c=relaxed/simple; bh=3UJpBvSAOxjGq+V44DiEHigwXSZSvkEPXsPGL93HZoY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=rF1n/tODhYBFh0o8tk07kVPkCEHcvsgjfFxr5sRT+PzOht//jNawCC6p9KvxCjeWvQWEdM0EUudCeHx1zRGPaSALAt7bUzBsZREWVDOGV5X1jQWy1/K3zF16tEY3MTICJ7xsXzEb1LHtOlcG4MX7hXZt12h2r6LZ2pKWBNSSjUM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=WRDPzXZk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="WRDPzXZk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SMo4jBzg968VcT1tEVh1MekL7DuKyZ/p1dzOuEaPw7g=; b=WRDPzXZkkldwBggMATh31iIK0vyxvEdvkgf3EYgI4GVRUr42isXBUFQ9q6TTndjYx/IUMX 1Q4FnYELw+2ryXEAi+NuM5ePzLk1pi5UxGNvQsP54RhfoCDo8IUKTahFCAEYQbBshSnWnQ WomElTUAV7xCYYt0eEI4Bc1AY5H7Rjs= Received: from mx-prod-mc-01.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-170-q4F2WwCWPOek5DYDs2vaGQ-1; Sun, 30 Mar 2025 08:17:51 -0400 X-MC-Unique: q4F2WwCWPOek5DYDs2vaGQ-1 X-Mimecast-MFC-AGG-ID: q4F2WwCWPOek5DYDs2vaGQ_1743337070 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 21841196D2D2; Sun, 30 Mar 2025 12:17:50 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B2190180094A; Sun, 30 Mar 2025 12:17:46 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 6/7] x86/mm: remove p4d_leaf definition Date: Sun, 30 Mar 2025 20:17:16 +0800 Message-ID: <20250330121718.175815-7-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" There's no p4d huge page support yet, let's use the generic definition. And also update the BUILD_BUG_ON() in pti_user_pagetable_walk_pmd() because p4d_leaf() returns boolean value. Signed-off-by: Baoquan He --- arch/x86/include/asm/pgtable.h | 7 ------- arch/x86/mm/pti.c | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5f4fcc0eea17..5ddba366d3b4 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -292,13 +292,6 @@ static inline unsigned long pgd_pfn(pgd_t pgd) return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; } =20 -#define p4d_leaf p4d_leaf -static inline bool p4d_leaf(p4d_t p4d) -{ - /* No 512 GiB pages yet */ - return 0; -} - #define pte_page(pte) pfn_to_page(pte_pfn(pte)) =20 #define pmd_leaf pmd_leaf diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index c2e1de40136f..190299834011 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -206,7 +206,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long= address) if (!p4d) return NULL; =20 - BUILD_BUG_ON(p4d_leaf(*p4d) !=3D 0); + BUILD_BUG_ON(p4d_leaf(*p4d)); if (p4d_none(*p4d)) { unsigned long new_pud_page =3D __get_free_page(gfp); if (WARN_ON_ONCE(!new_pud_page)) --=20 2.41.0 From nobody Fri Dec 19 18:27:44 2025 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 733881C5F39 for ; Sun, 30 Mar 2025 12:18:01 +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=1743337083; cv=none; b=QzFs96HcWuq59UfK4pi9zERA+J5Qk0hvuI18MJGYKZkDd3Vx9tKyuhhp7/IC2AZB/xfmc4K+6AbT2HzcVrCzA9+KM/d+7PkzpPiG5RQaXv1UpkMKr0ZCzy9F5+u9aX5Y64Rh5lKp1kNuc44WIijHQNdJbJlIllIX5vwBLg1B2So= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743337083; c=relaxed/simple; bh=KudWMVHRlgaYmmxW7ze9gtxkeRaW2ruu2MZ2Lcgfx10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=A46JgdHw0WCxJqp9LjEYW0oHydVPaL270yO7Adl4nYfA7Tcn8SW7cORqfZDtEqX0vWvp7NM/rHYOpAHC+KUe7qJfkRYOByqhyO5siKN0ELxqdDnIsBTo8o7mcEUeS3JhglLCBL+wdRDXeSEL0p6vlWhbyqGifinWd4xE4QanZLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=i1BRBXCM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="i1BRBXCM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743337080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OLa+87RL1ZqH7qyvR+sAYoFO3JtN0cQjwozLl9C4JYM=; b=i1BRBXCMKpF09IyurvUT78dyKQqnqGFrsw0bIq39ug30xoXuIvLz+1fRaG9ga24KNsG0Ln ZGzqa2RQYn9xKu1uGhBAYZXC4FnNMCNI0CIZ8eQIT+eWGz8N9aVR9IycGsKHlMuEUbwsar E/Qvi61Zb+Jc88zIaYzxlKvvOXlvNfE= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-LnXfi8BcOTSlNfX2co1fyQ-1; Sun, 30 Mar 2025 08:17:55 -0400 X-MC-Unique: LnXfi8BcOTSlNfX2co1fyQ-1 X-Mimecast-MFC-AGG-ID: LnXfi8BcOTSlNfX2co1fyQ_1743337075 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA27218007E1; Sun, 30 Mar 2025 12:17:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.17]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 883731801750; Sun, 30 Mar 2025 12:17:51 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 7/7] mm/pgtable: remove unneeded pgd_devmap() Date: Sun, 30 Mar 2025 20:17:17 +0800 Message-ID: <20250330121718.175815-8-bhe@redhat.com> In-Reply-To: <20250330121718.175815-1-bhe@redhat.com> References: <20250330121718.175815-1-bhe@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.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" There's no user of pgd_devmap() now, remove it from all ARCH-es and linux/pgtable.h. Signed-off-by: Baoquan He --- arch/arm64/include/asm/pgtable.h | 5 ----- arch/loongarch/include/asm/pgtable.h | 1 - arch/powerpc/include/asm/book3s/64/pgtable.h | 5 ----- arch/riscv/include/asm/pgtable-64.h | 5 ----- arch/x86/include/asm/pgtable.h | 5 ----- include/linux/pgtable.h | 4 ---- 6 files changed, 25 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgta= ble.h index 84f05f781a70..e0cab581edc9 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1230,11 +1230,6 @@ static inline int pud_devmap(pud_t pud) { return 0; } - -static inline int pgd_devmap(pgd_t pgd) -{ - return 0; -} #endif =20 #ifdef CONFIG_PAGE_TABLE_CHECK diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/= asm/pgtable.h index da346733a1da..d9b04296d9f5 100644 --- a/arch/loongarch/include/asm/pgtable.h +++ b/arch/loongarch/include/asm/pgtable.h @@ -615,7 +615,6 @@ static inline long pmd_protnone(pmd_t pmd) =20 #ifdef CONFIG_TRANSPARENT_HUGEPAGE #define pud_devmap(pud) (0) -#define pgd_devmap(pgd) (0) #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ =20 /* diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/in= clude/asm/book3s/64/pgtable.h index 6d98e6f08d4d..0da1c8d7f778 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -1405,11 +1405,6 @@ static inline int pud_devmap(pud_t pud) { return pte_devmap(pud_pte(pud)); } - -static inline int pgd_devmap(pgd_t pgd) -{ - return 0; -} #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ =20 #define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/p= gtable-64.h index 0897dd99ab8d..c6da4c8354a3 100644 --- a/arch/riscv/include/asm/pgtable-64.h +++ b/arch/riscv/include/asm/pgtable-64.h @@ -411,11 +411,6 @@ static inline int pud_devmap(pud_t pud) { return 0; } - -static inline int pgd_devmap(pgd_t pgd) -{ - return 0; -} #endif =20 #endif /* _ASM_RISCV_PGTABLE_64_H */ diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5ddba366d3b4..3d6e78af525a 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -361,11 +361,6 @@ static inline pud_t pud_mkspecial(pud_t pud) return pud_set_flags(pud, _PAGE_SPECIAL); } #endif /* CONFIG_ARCH_SUPPORTS_PUD_PFNMAP */ - -static inline int pgd_devmap(pgd_t pgd) -{ - return 0; -} #endif #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ =20 diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 94d267d02372..9d2dd5f71443 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1615,10 +1615,6 @@ static inline int pud_devmap(pud_t pud) { return 0; } -static inline int pgd_devmap(pgd_t pgd) -{ - return 0; -} #endif =20 #if !defined(CONFIG_TRANSPARENT_HUGEPAGE) || \ --=20 2.41.0