From patchwork Mon Mar 31 08:13:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 14033787 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 E1D32C3600B for ; Mon, 31 Mar 2025 16:29:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E362F280002; Mon, 31 Mar 2025 12:29:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE3F8280001; Mon, 31 Mar 2025 12:29:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD426280002; Mon, 31 Mar 2025 12:29:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AEEC3280001 for ; Mon, 31 Mar 2025 12:29:12 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F2F34B9A2D for ; Mon, 31 Mar 2025 08:13:54 +0000 (UTC) X-FDA: 83281132788.14.C021D86 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 5E7B1180005 for ; Mon, 31 Mar 2025 08:13:53 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OnOLQ2Uh; spf=pass (imf24.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743408833; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Zh1/TrAESP0WnH+wS47UsqcVh/5ztuo1zl6IdlNR8C8=; b=UZMOHFaY3sSax1bNB2oZNkwzuYzBkl68jhDyMF7SspaX5M3TkDwrgQBPuS6MwMQtN6h/IV WFeAjaPChPMDgAhImM3BnAiizNX0o45tmwcBQCgYGd5TiFepC3dJAakL5TkChM+88iyZib 1cJPmcenfV5qIaClXJ1Wm7OQZm1c80U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743408833; a=rsa-sha256; cv=none; b=Inuvo25QLnM0BYuNecyvqZIm9ebTLbGBUKnBI8mYV2cE9zBbaaIesrE1JbMwLmOwThNvfp nDaBvvSsFeHKwTWgMqru8k0bYbrrq+XtQQZ8+LPHS4FxdVhQAfaI5qRAjzG3vBSzxMAHz3 ohgRlCsLIQC+hdXpbyijG1oazPBPN70= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OnOLQ2Uh; spf=pass (imf24.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743408832; 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=Zh1/TrAESP0WnH+wS47UsqcVh/5ztuo1zl6IdlNR8C8=; b=OnOLQ2Uh5jb07mW41Bn6ECdTkHrfpYyyFcpqV4r96gz+wmYHSgBmtXI2jGWya+2eKH/bVo 6nNIAuMVg+42nDf07+F+6OjbH4scIruWugxgSMav/ntqvh7dHNE7/lCeYXmZhGJS/Dsv4M nqI0JCHTqG/tvZT9wcfQBGrsBEF3EBo= 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-164-Dl07PehiO7uuJ-PB7EvKqQ-1; Mon, 31 Mar 2025 04:13:48 -0400 X-MC-Unique: Dl07PehiO7uuJ-PB7EvKqQ-1 X-Mimecast-MFC-AGG-ID: Dl07PehiO7uuJ-PB7EvKqQ_1743408827 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 602D31801A1A; Mon, 31 Mar 2025 08:13:47 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.9]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1BC941955BF1; Mon, 31 Mar 2025 08:13:43 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, yanjun.zhu@linux.dev, Baoquan He Subject: [PATCH v2 3/7] mm/gup: Fix the outdated code comments above get_user_pages_unlocked() Date: Mon, 31 Mar 2025 16:13:23 +0800 Message-ID: <20250331081327.256412-4-bhe@redhat.com> In-Reply-To: <20250331081327.256412-1-bhe@redhat.com> References: <20250331081327.256412-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Stat-Signature: ftxw81h4t9dahszytb7ex6d817morssd X-Rspam-User: X-Rspamd-Queue-Id: 5E7B1180005 X-Rspamd-Server: rspam08 X-HE-Tag: 1743408833-829039 X-HE-Meta: U2FsdGVkX19bkyXE7l4ZsuawNNVETaXBtFv0FJCnguEyD5F9VFiEf2Q7gGMuGbTNw5uyH5h9Fa2zs9sLYXmLEqXlrdHOZFlqSLoxOJZ2RPFpjCns++D9UxyaCveQ8HWbgWMwA3I+/ijc4z6pRuN/V695wCqzsnpwt1A/DLSECdjEKPwxqz37vumQxDgCXZIeYuwdfliG7XuqBkrf12h8x5zYCzsc68DOILfCxkJ05lx9rk58c+70koIAS4S9tbkRvjtIflBd2JTylPdVH+wjMnYo+dUjBJ2d6jPItI8AT/K7KVo8icYc/4QFWvdhGCIb8cd3n+TVukQbW5WlST2V2PgAbXmYwpIHR29+uVeZZWsrzJqULTQunfQJYPPpI7Xo6gSP/zeuctnibHz//usSKUu8SFSBWxSkk7zcveGOtJMaWL7hbZ3nvKP7fDQw3JleLdqP4U7/uL/d0AwTYyZJmboCDGgTBhy3zltdSyIVo7IGWae40qDiqLXSXyPxg1a5rhy7viQb137CJtChfWAJ1uJuBNtVS6KqCycKDeBoDUCn9QrahZ66dESKheKxw1jhMuvEJ1PD6oNgEKHPwGTfuQYMYQ8LKJ5Y6CliFv6qZs/abrQdSTxOrnSkog4DO/cE5t/EIadsjpAFWtqEvSio8L8cHndbMJImRewZtie8FB/AF2HMtVHXO69iAKLn5q8CRQJii9HSsWVjtCUure4UCFRTU3xM9N7pKsG0/VhBkb5e43YOkvN57mokM4vj6EtR0httfKBWLUs05pCbxpdxhVKBkbUzBpMUADgCpykAN1bEEOabJgb3//MmPIpYeF+T1MLCMuOxhkbOoUI3F+xNn/GPL7PEn2lGKcB4R3SmoHQaTehxcsqM/SKQRpVGkesF8Sle7M5Gt4WfBh1XVPBW7vLgKDydIm0viji5MifbUkKZocrhAhhLo+zCzueNPB37H7AVt31Hry7udvgECrR u2zeBLum ki7FiQWg38bZ5voTJYnq3ARe5sVv2n9St1Xtthgga88LreA+cdYUHbj2Nj8nx8ioSsAQIHO7B6YBlEGUHAZC3GdFey+F7sKcBNtNL6v2FsXX/3Sc= 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: 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 f9bce14ed3cd..a15317cf6641 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2702,19 +2702,9 @@ long get_user_pages(unsigned long start, unsigned long nr_pages, EXPORT_SYMBOL(get_user_pages); /* - * 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)