From patchwork Mon Jan 13 13:16:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13937329 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 783F6E7719F for ; Mon, 13 Jan 2025 13:16:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D22426B0093; Mon, 13 Jan 2025 08:16:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA9986B0096; Mon, 13 Jan 2025 08:16:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A39566B0098; Mon, 13 Jan 2025 08:16:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 82EA76B0093 for ; Mon, 13 Jan 2025 08:16:52 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 33626C0293 for ; Mon, 13 Jan 2025 13:16:52 +0000 (UTC) X-FDA: 83002478664.19.6AF9681 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id D35FA2000C for ; Mon, 13 Jan 2025 13:16:49 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fn+0UZ50; spf=pass (imf03.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736774209; 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=Owz/t4LPLm8R10JBYoc8bZ8ehYgkHbNPd81HY1H1C4s=; b=LyslKVk8SsZofBS3FUgWPz5eJROXnK0WBzHHGEeokC4g40+QPN9Of4HTNq/nng63SMWLjZ dFMs/GIwAa60Ud+6F9Wa8pGo76WdJNXTDKsjndKUqWkGek9RddjR8m3D1U1Ug+mBlYZbrE D6HWy3b/njFg3pdAp+Ks5FQ5CoNxnlw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fn+0UZ50; spf=pass (imf03.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736774209; a=rsa-sha256; cv=none; b=EKQtdUHkX1nfsiXqiKCwau3VNqWkw3QJLH3XOnmkMYPF4KtsZvGsaUxYGMx6A4wDEcxd0Z 4cRVNhAdvuH+VKrkOSAVjcByo4yblLORDRDRCA9Uv4faDSR5k+EBdx7W+uAcI6lcRTFnHT p5B2/2L6Nf4UL0rm5uqt1XRqA5Qe27I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736774209; 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=Owz/t4LPLm8R10JBYoc8bZ8ehYgkHbNPd81HY1H1C4s=; b=fn+0UZ50ndRIbqoNpG5LsUgeQmgvax/7Gq6vnys6bWva0zsmjX011ywsQ4Q/yfEuI1FfgV tkyVTNqSCQ8g08EWX2eXaK3AGkCxlNfG8bLBmsgKmQhLEgV/cjEcvfepWavUUCMm9bQ7tA vDRL25tokHYImsuIkh0QLQ3+R/LOtB0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-A6ahor4vMX-osp6rY6p5wA-1; Mon, 13 Jan 2025 08:16:48 -0500 X-MC-Unique: A6ahor4vMX-osp6rY6p5wA-1 X-Mimecast-MFC-AGG-ID: A6ahor4vMX-osp6rY6p5wA Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3862b364578so2441205f8f.1 for ; Mon, 13 Jan 2025 05:16:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736774207; x=1737379007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Owz/t4LPLm8R10JBYoc8bZ8ehYgkHbNPd81HY1H1C4s=; b=g6wecxcYtm22CBlqpJxVEPFyJxfNEOX3ovUvzTCrnM1BI8IXaqn5xJcInEfRTNq78w IpEri8HxBnW31RuSKXnM9gFLnUGXZNptDw4SRXuKFPkcHnbELKctNbwktrYpK5yXPgzF O+mclpS1zB80ZHEuX4Tu1CheU0m+XRPNP9dqwBmMvbu0d/xD9Qj0wxNQNzNykqX3SBTS /Y3BpdgIQgqRbaa4NlBR+/I56rX7jVT5DDrZY/UstMs7Wxs73jCfpEKUSQlMgk0fw6OB cfHs5HoB1ybf/tiRKOUiI/cTXF14Y13K7V9yqnClG59uTeFdF/xuZUGTdv2Lom7YC/ws dtyQ== X-Gm-Message-State: AOJu0Yz2wC6ptNH4okFqfzvMy8+O0UlqN4kXWv/Qyh/Pvz+SS+9xyh9t aSbhh+H5dcZQd3XRzHYi7gi0xewCtmv6D3804s9YvTwkk2Kz6Zy0umChRZA/tY30b4vuS1XewP/ V/Pvy0slgZJqTEN7HuWFdUJgz9CHq4d8Qkmmy3Kd8bPCU1ldb X-Gm-Gg: ASbGncuO4+tzqm9i0c6mv+OlXVK4vM9+LiGN1Hsxj/G9KMqftYHcbByvH+Ryr0YKcnE 6hcyaQvR2ifDdqFPeXViLkOyLrroOtiqvpFZYyQrbk2N8jgPanmpDMfS50z2jL7OH+QYQX/r/Fl QJmWzDt/xHJQlwmSQlWequtkXixMSaiS+0/zI5eG9KHicSQPyt5ndpZT5e9fENBZJKK5JH3r5Wb 8zwFGLK/x802QW2SRZwdaQnX8U24YohKkvEJf5Kwl8ACnPneYg+ X-Received: by 2002:a5d:5f42:0:b0:386:4570:ee3d with SMTP id ffacd0b85a97d-38a8b0f693emr14694191f8f.24.1736774206982; Mon, 13 Jan 2025 05:16:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmlNBWKTxitwUU8z3/x/DgIgt/PZq5l0prYnPmi8qWosnAo/rWsMNVPpJ+h/+u9EwIDLlc0A== X-Received: by 2002:a5d:5f42:0:b0:386:4570:ee3d with SMTP id ffacd0b85a97d-38a8b0f693emr14694155f8f.24.1736774206584; Mon, 13 Jan 2025 05:16:46 -0800 (PST) Received: from localhost ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38a8e383965sm12339069f8f.31.2025.01.13.05.16.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jan 2025 05:16:46 -0800 (PST) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Muchun Song , "Matthew Wilcox (Oracle)" , Baolin Wang Subject: [PATCH v2 4/6] mm/hugetlb: rename folio_putback_active_hugetlb() to folio_putback_hugetlb() Date: Mon, 13 Jan 2025 14:16:09 +0100 Message-ID: <20250113131611.2554758-5-david@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113131611.2554758-1-david@redhat.com> References: <20250113131611.2554758-1-david@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ecXvIR64Sw3UHAfjDfljt18OfS-GC3D5nYyJBmIAfnU_1736774207 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: D35FA2000C X-Stat-Signature: m9dhekt9n3erejzpoyyz1dhm1x4oqi89 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736774209-801990 X-HE-Meta: U2FsdGVkX1+v7EnpNzyEiCcmH0z0qgQ0JF2GczAiLeoD4dTwTpvOj4rsjpoClDd/KO9i/O0AnQykyIZL8oZPJAc3Z1Kcudbg45QQMBQyy6o2DFt3xrZJS1ekI6X5SBmCnArjdyduho2G/e/ryruRmw1e64dmQmTGsti/zoDxB7MveJ1gu9lu4RLlNOu2KLi5Cb/jMJkNyyik+jSjD4jiMkE/ZLz2/gi6nF/IWvGQFtZox3ZZqiRyQwXuho17evytkgn69aWETtzmTdf55YTK5eqCBUuf9XR09grVDkuDr6oy0HMDICFcngFv8A/muFXdjNPjqNa0RfcKUf4fCB0x2Ghhwl8YCNTu6BKlNbc0kXHqLL0pdf6WtkR5fpoJDnyaWdzWa1bIxKGFgy2GZNcf+YGlQ0PCcPJxEYJWtU6ScK+3IQb5/ufdSzR//8s3UvFVhgKfvBqHjDozwtJUDNyw88o+3M2h0Oex3kDV8RRjWhEYRng7U6Lew4XC0sroea452eT5+sIFaCFR2eTXuoNpu+vtHa6bGPiN4JDJNhJY6+yCgWvAAIKoomx43bPHfLznbJhP/R5RvEZLIYYxD7wWC0kOY9D9xKiX6Nz3UewE/o0hCSfADiaI+cq9gssifQZCpnjQmttHniOIZQ1sKN5PNcjRErKdFZtRRZGh5CTnMtFMbWIb5T4A4apYfr3cDl3P1xjFwI0Ax3gqoYfeB2ngcGyNQa7UEVzskeKx6xFK+mJ2ycbLPo/YvqFjgJe7j2SSXOAhRaVW5kPiknVAjT1I8g2BFUtWG8zXrlzwviUMT0i92dbqP68frUBBE9LQEla1y3zW5/E+sS1TgnLo1X8Pc/BRf7DDxZvTJX3LzhZJiBpYUFdSv7mfwujchR7D2SX4iB2IyrWxEN4zMVj+Ya2T8C5ARAJxTIw5hvFLektdoN29aXOOqDBiulygNiAhdiu4faXtlHX18Na8n+8aPPa HTY6LWOg 7Qu9XrdHF7JSK9SF3tMhhK5Rxsrbl9CEd0RrPkq00aexPqpksv5rshnN8DqOyvEL54Yz/6if5eDttI859IhEyA9QUC7iXIBY8WvjeRQ6psJQrsAeGZzcmLSYQwNg4UH4ZnuhqCdsgskqpOhZDPx7xlTcmv+diPXKu3i7U9YZso7Uuc7OBoIBBgcn3puSrY5WIA6YQuN7hadeYbVMshGxB2mhw6BhYeqX5LsO5nFUyZR25R9Yvw4/j2U1MA/UW31TyNt0DpBgfRbxW3WbJJXJVyVDAkPmrcNHcoBdUiy5dnU5d1fr46X+MmyegBHGCwllkJxWZJ0EA1lgTjTzCeZBuIQ1o9UneNUmZ9TOrgFdrKjI3+FgOq9rASOZVFHvumXrnLDrgt04/iitmFUxKSzLrer0BVNO2GIIfw1fRFJMb8JrUWdW1oUR6i0Xp1oRKSRICbgpeEGdNku52cuwJMN2LiNpN7cvYthTaFlZJWArxA20PEXf4OXEfM81+trerQFPQ4OjDKgWM/tp4PISDjC6jVknotA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000037, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Now that folio_putback_hugetlb() is only called on folios that were previously isolated through folio_isolate_hugetlb(), let's rename it to match folio_putback_lru(). Add some kernel doc to clarify how this function is supposed to be used. Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand --- include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 15 +++++++++++++-- mm/migrate.c | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index c95ad5cd7894d..ec8c0ccc8f959 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -157,7 +157,7 @@ bool folio_isolate_hugetlb(struct folio *folio, struct list_head *list); int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison); int get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); -void folio_putback_active_hugetlb(struct folio *folio); +void folio_putback_hugetlb(struct folio *folio); void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason); void hugetlb_fix_reserve_counts(struct inode *inode); extern struct mutex *hugetlb_fault_mutex_table; @@ -430,7 +430,7 @@ static inline int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return 0; } -static inline void folio_putback_active_hugetlb(struct folio *folio) +static inline void folio_putback_hugetlb(struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 95579bd8c4fe0..bc4ab45d9b93b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7430,7 +7430,7 @@ __weak unsigned long hugetlb_mask_last_page(struct hstate *h) * it is already isolated/non-migratable. * * On success, an additional folio reference is taken that must be dropped - * using folio_putback_active_hugetlb() to undo the isolation. + * using folio_putback_hugetlb() to undo the isolation. * * Return: True if isolation worked, otherwise False. */ @@ -7482,7 +7482,18 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return ret; } -void folio_putback_active_hugetlb(struct folio *folio) +/** + * folio_putback_hugetlb - unisolate a hugetlb folio + * @folio: the isolated hugetlb folio + * + * Putback/un-isolate the hugetlb folio that was previous isolated using + * folio_isolate_hugetlb(): marking it non-isolated/migratable and putting it + * back onto the active list. + * + * Will drop the additional folio reference obtained through + * folio_isolate_hugetlb(). + */ +void folio_putback_hugetlb(struct folio *folio) { spin_lock_irq(&hugetlb_lock); folio_set_hugetlb_migratable(folio); diff --git a/mm/migrate.c b/mm/migrate.c index 7e23e78f1e57b..be9e3b48cd622 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -137,7 +137,7 @@ void putback_movable_pages(struct list_head *l) list_for_each_entry_safe(folio, folio2, l, lru) { if (unlikely(folio_test_hugetlb(folio))) { - folio_putback_active_hugetlb(folio); + folio_putback_hugetlb(folio); continue; } list_del(&folio->lru); @@ -1454,7 +1454,7 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio, if (folio_ref_count(src) == 1) { /* page was freed from under us. So we are done. */ - folio_putback_active_hugetlb(src); + folio_putback_hugetlb(src); return MIGRATEPAGE_SUCCESS; } @@ -1537,7 +1537,7 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio, folio_unlock(src); out: if (rc == MIGRATEPAGE_SUCCESS) - folio_putback_active_hugetlb(src); + folio_putback_hugetlb(src); else if (rc != -EAGAIN) list_move_tail(&src->lru, ret);