From nobody Sun Feb 8 18:15:20 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 9E82121423F for ; Fri, 10 Jan 2025 18:22:11 +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=1736533333; cv=none; b=UIvcAsUBHEYJ7z+yBFLrybB7UfpkofAuSFE5I4reSoiY811lOtHouvzjn54S7SglZp4BYsvbe+aoHLgdtHzVujVJdx27iz5GmZHgMQEEuQYRG4ujJ+xHEiThzQWROJvVS+6Tv3PpY67VM4r4eiqT57k3d+ssoHoI9OlC2vroDbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736533333; c=relaxed/simple; bh=iEK/YDu+08UL/AKxpodbweKdplQEIahFN4WAYnoKPUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OSI5oBg92MKb+bZL+B9XB/A6W66zWUqv7XIKh4KeCZAaQyuXGXikuI4A+n0t/6ROP6aQ+HnB69nN/LOmhQ7IVWdLMMigDx80oHwOyS4vmN1HyOF+3HtHkpLSrshWGiYGSaTrUEP1fGsEQStx7h3Dppl/u0K/KN5oQX8bNJJ/i6o= 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=H+EA3ouH; 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="H+EA3ouH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533330; 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=OXRC2m94ydMkiYC7QjOXtCup/ACjP0VRhTV9k+2JNqs=; b=H+EA3ouH8SNWi9lyxWAqC2iOQTtHPELzGlJ9zNJ1fuYyNXjA26c9JUx+T+6knmVws82nfF XWJ3hE9bxfhI261JKhiC/6CKLPLAmpV/mQtW8BMmUvWQkyFoT937qd38bOOHC7WQUoClrO U7kCBG6Eu3xAp5h68nclcxkJO8CjuGU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-d2P9QQKvMDS78a4lYXwovA-1; Fri, 10 Jan 2025 13:22:04 -0500 X-MC-Unique: d2P9QQKvMDS78a4lYXwovA-1 X-Mimecast-MFC-AGG-ID: d2P9QQKvMDS78a4lYXwovA Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43625ceae52so12724455e9.0 for ; Fri, 10 Jan 2025 10:22:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533323; x=1737138123; 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=OXRC2m94ydMkiYC7QjOXtCup/ACjP0VRhTV9k+2JNqs=; b=ER7hi/WdVq6bszMl6q4IQYuZIiSTwR27EnQ3KvoIuc9tH7SduJWqQsiTAAjf/Dej2L Ua8kpbKqp/7BT+Yn6IZRhy81jaJXeFuwY4KYp2ZoJ0SvFBNZeMC7eBm/+Vibw537KW8z wAERrVHW5eiVmLaga2W6Fn/WYN7GpNsgxsDJngjCCMp/38vfi3jzPsfhrADFZ6ZVHcvu LK8nbFQvPZgkGX+ReCDEWd4XQBXXvl38GHLsiIUtF2ht6BBLlclhSSUo5g72dW5r/Ajp dwa0yFK/RrHVk6MQNI7ogePey7hbl0MIktnpEP0y2wiiX8SL1eLg9iGSxFhuXj9GcJH4 97aQ== X-Gm-Message-State: AOJu0YwVJ++8nair3Aj6RJbFRXGWITkmnR7qsHkuW9z5rN2M6BDArHSG nrt8eKHrEVUP6jtojUwutjZbfJUKGZJthRoGxrklZAyfOb8VZ2ICj6mqFIQJs+jV/O0OSUzCkoj U210bVzrrr3W+Gp2aveRLnQKXmY9qe/bGEP+r7kwq/rPjnCQ0pDfA8YG9YSbyT6IaMzED/HqZcB CSRvbwz6hp9NUkFG+5nuTNCcCBlVb5epi4oXSMWM/Eq0J6 X-Gm-Gg: ASbGncuUoqB+Sl9q5l0VmclG21+RPT7J0VmDneYy7XfIK0/SMTmRqpDhRVYeek/VvOF hW3rLrQiuJiwsxXaQ0bKPkttv8+hgbMDSudJdacWPj11E7AVeP1hMIppDQlxAByciSvugSjjXe+ mrIY8q4tUSGbISyMEq/wcRGfjB8P5iRE3aT6UaN0woYy5r/nUCUoSGKYVpmxa3KUQ6lLKg5GUdQ Rfjg7PRC8pkVCwreERDl51MI7uxyHsxAZsmMKNQq9pGywavKlk/9teFr86nLvHPEPfpBiW8/d8S p6zuQ7I+rvaJe5b8aK4heyG83+N3SXywoYsn3Cidyw== X-Received: by 2002:a5d:6c66:0:b0:38a:4184:151a with SMTP id ffacd0b85a97d-38a87336d7emr10411547f8f.37.1736533323293; Fri, 10 Jan 2025 10:22:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcugPNnXNH6gMdckC0/5oXNeYEtkcYkpb+AZRe4LzLi94i5qkTLkfuV2gaEgGD05bAwgio+g== X-Received: by 2002:a5d:6c66:0:b0:38a:4184:151a with SMTP id ffacd0b85a97d-38a87336d7emr10411528f8f.37.1736533322896; Fri, 10 Jan 2025 10:22:02 -0800 (PST) Received: from localhost (p200300cbc708e1004f41ff29a59f8c7a.dip0.t-ipconnect.de. [2003:cb:c708:e100:4f41:ff29:a59f:8c7a]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38a8e38c990sm5194620f8f.56.2025.01.10.10.22.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:22:02 -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)" Subject: [PATCH v1 4/6] mm/hugetlb: rename folio_putback_active_hugetlb() to folio_putback_hugetlb() Date: Fri, 10 Jan 2025 19:21:47 +0100 Message-ID: <20250110182149.746551-5-david@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110182149.746551-1-david@redhat.com> References: <20250110182149.746551-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 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: David Hildenbrand Reviewed-by: Baolin Wang --- 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 un= poison); 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 l= ong pfn, int flags, return 0; } =20 -static inline void folio_putback_active_hugetlb(struct folio *folio) +static inline void folio_putback_hugetlb(struct folio *folio) { } =20 diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b24ccf8ecbf38..60617eecb99dd 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7430,7 +7430,7 @@ __weak unsigned long hugetlb_mask_last_page(struct hs= tate *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, in= t flags, return ret; } =20 -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) =20 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_n= ew_folio, =20 if (folio_ref_count(src) =3D=3D 1) { /* page was freed from under us. So we are done. */ - folio_putback_active_hugetlb(src); + folio_putback_hugetlb(src); return MIGRATEPAGE_SUCCESS; } =20 @@ -1537,7 +1537,7 @@ static int unmap_and_move_huge_page(new_folio_t get_n= ew_folio, folio_unlock(src); out: if (rc =3D=3D MIGRATEPAGE_SUCCESS) - folio_putback_active_hugetlb(src); + folio_putback_hugetlb(src); else if (rc !=3D -EAGAIN) list_move_tail(&src->lru, ret); =20 --=20 2.47.1