From nobody Fri Dec 19 07:49:31 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 7EFD423DE98 for ; Mon, 13 Jan 2025 13:16:50 +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=1736774212; cv=none; b=pRo7rZRlSmgiMSTLpf33VZiL32kNJZty4sZ62I9KD9p2eBX1lCyR8gUOD3QkIitvRv43C6GKoOFudPitLCL+QykaGnnww9yFTLK/4WiP7rU6I7EuwFnNqgXOp+r6QQlCRMOdnWOEqSrQ7rLYgq7Y4FWmZNQ6pw0LKv+c5hP0/bQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736774212; c=relaxed/simple; bh=ZBzdYtIZc2XZHPI/PcxCh+jv9RdFaJibeyCQ3zaVSaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s5dK1ZseMOSlX8ekxr4qUeb1Ee+NoK6rrdGRG+4I7RaZYd6fesCv1jiDv+fHqlz3ULGDLSbFjxwRj/G/u/qVCA7lkFOV9m26/VZk1iNjcR/mZDJjCbCy8Cx2zrOwk3RzKowrum1jIt1w4GX632ma5oRJsbH/CWr2fh0Mt21JbxY= 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=U6Btezh1; 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="U6Btezh1" 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Owz/t4LPLm8R10JBYoc8bZ8ehYgkHbNPd81HY1H1C4s=; b=U6Btezh1PcOBmqdNxarfbhMP65D+yMJBt3QizQ6SZXNn5HPJY2ymsyYDTo17FBfBSHm6w8 OO5cLLva7TiK/8Fx9IGpxeAEyTv+n8BbxT9v8pWryqnwVzfEPfCaXyvs38WJ+8h1dpus3E crgA4d+PejYR0zA9TMrcb0A7NT0YOjg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-jwmss5yYOOK9gDo-SsSHuA-1; Mon, 13 Jan 2025 08:16:48 -0500 X-MC-Unique: jwmss5yYOOK9gDo-SsSHuA-1 X-Mimecast-MFC-AGG-ID: jwmss5yYOOK9gDo-SsSHuA Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-385ed79291eso2412849f8f.0 for ; Mon, 13 Jan 2025 05:16:48 -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=X5o1AVS2ITsyeyz94opb41U8ZO3NkmEE3vtlT1v8zluf3Cry40PjqrQEe+L7mOk604 iolB1nBFAQWKBjwan2pqv+tLj98V+eu95FNayPqsaqCgslQOIWBltb3P4fY8rkxKPgoA 4eGheTDNXHNb0fExX6U7eSEa0z3Orh0jKUe6/rXZJF0zVK4ow0DOIyVK4LqZdSa57vFO MrBXMa9vl1E5aCcC2sNbxScfJAikSmwFMvaLRpZPVuyXTD8uaeOP85rZEdrhVJk0c0dU fEj+RR0U72OFupAU4u6YHZ3Id0lUFA0bhu7a1+X3q4JdJt2qf0DmuluIOcTGdPtIAORQ /9QQ== X-Gm-Message-State: AOJu0YzugP5IGeNHlZ3MHC3VgJ9H2kL5ip3Qu06W5FJlGT2XbttfSFkW H8YA/IP5J12es75vNVQnE5mLYZ8ig9e4X0vFYM7Rxck4N7ezY5TK8ZtL8YIIvToglhuR0dtdfKe ANNUAxpayEJPZMe67oEV4d+vcn/VrLST7iiOM76Xxn8ZmvgCZmz9iQnuKV7f3InUKv2zQbxgRsg UP4X0F0aTnQoBa9ITam2aO+Q44nyuMYwKIG2hVfMY+Tc1s X-Gm-Gg: ASbGnctPOG6IWMVfIRjM5OALAyst7R1u42R78fndo7HRvvQPFf2ZoexcMKq73923vqn 1LRgydtjrvJNB3bJlgoCUfuRK3d+F1fVgcNhLk59jTGf7Za1GQFsBUtEApYV8YWlHHFdenjLFBt JnExrcR1JzY7itK2yVPxzJjZlXiLdYiIgliACm8lll5pQR7qSs+zxZok3iqD4QSAcxog4i+KugQ HxPMQ1OiULSP1MbxLkV6eK8o0QPNkEp7MyvmixRKlkPWYFL8wD6 X-Received: by 2002:a5d:5f42:0:b0:386:4570:ee3d with SMTP id ffacd0b85a97d-38a8b0f693emr14694197f8f.24.1736774207045; Mon, 13 Jan 2025 05:16:47 -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> 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. 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 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 95579bd8c4fe0..bc4ab45d9b93b 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