From patchwork Fri Nov 8 16:20:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 13868437 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 3021CD64061 for ; Fri, 8 Nov 2024 16:20:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B616C6B009A; Fri, 8 Nov 2024 11:20:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B10486B009B; Fri, 8 Nov 2024 11:20:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 915186B009C; Fri, 8 Nov 2024 11:20:53 -0500 (EST) 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 6C69F6B009A for ; Fri, 8 Nov 2024 11:20:53 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1CAC01A0DF7 for ; Fri, 8 Nov 2024 16:20:53 +0000 (UTC) X-FDA: 82763441208.28.13C0580 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf28.hostedemail.com (Postfix) with ESMTP id A6A95C0012 for ; Fri, 8 Nov 2024 16:20:13 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=fK0Yvnj8; spf=pass (imf28.hostedemail.com: domain of 3YTouZwUKCM4Duvvu08805y.w86527EH-664Fuw4.8B0@flex--tabba.bounces.google.com designates 209.85.221.74 as permitted sender) smtp.mailfrom=3YTouZwUKCM4Duvvu08805y.w86527EH-664Fuw4.8B0@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731082800; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=c97rKSzu5OtSEQDwZyqgn1x58KOnaAilRAoGtwwyknw=; b=r1/RhohHq38idZn45+diQqgC49rYgjOTl/gRzaWs9epxV59PU6eMP/YTyiNrRjyHk0sOQ0 C/gqW2PKJbkCUAYhR90Sisfc3vNnLWC4E6E3dlCi3ayj1np3kOee2bdvhfr1ElBQHKMpCh aH0prfF1mle5V+MWiFDIA++4UPL0UwQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731082800; a=rsa-sha256; cv=none; b=iI4JObsGAVroov7f3fjHwh7M+/CbR3/rjztjCvVCmbeSgVajZjYaAcm5Che4ZzM43WlgWH o/aYHZnIKpEfkc740HXmym3XTebMv+Dp4n+6iYg5A8ZsjtTWZ6nWhfOB2hoJO6CR0ajd1s U0S5Vgs6iSAiblcD2/qVRScZqn8dlPY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=fK0Yvnj8; spf=pass (imf28.hostedemail.com: domain of 3YTouZwUKCM4Duvvu08805y.w86527EH-664Fuw4.8B0@flex--tabba.bounces.google.com designates 209.85.221.74 as permitted sender) smtp.mailfrom=3YTouZwUKCM4Duvvu08805y.w86527EH-664Fuw4.8B0@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-37d45f1e935so1279773f8f.0 for ; Fri, 08 Nov 2024 08:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731082850; x=1731687650; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=c97rKSzu5OtSEQDwZyqgn1x58KOnaAilRAoGtwwyknw=; b=fK0Yvnj80DPONBoWOJkt0oQSF3SU6pzKCQyTFEe8XzM2RYdErzr9oL6I8PuMu1D3M/ cBGcsjWoizOABxBWH/kYq+es/OlkL7ckDN4u52YsHVnVFoTflAKMmVNJOBrpe5+0w57B tLC9s5LjTclGdR/P5ULYnUfJj3osRO4ivG0ujAvvpHiG1Lm2KinyS52ty+dGKaQRr0Es vPlfB5Zfe495cSRmaCCiP8olmtcA5gjVb/sDjQLWUZVq4T8L9Vssoe0uhbDn6MfIrSG5 c/uUBByzo9xkVfByAeLuC8wgbNizv739fm/o2SyvpYD4vPy5BUkXgNfnjmFu9wBs1Mm6 SPVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731082850; x=1731687650; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c97rKSzu5OtSEQDwZyqgn1x58KOnaAilRAoGtwwyknw=; b=u89a4Yv/N3j36zx/uOknpVFX9HIBVlMBDO/NfnChlk2dk6/V5vbfJ3YWaDp/MNzQQt 212yKiL0wjtmNm/wMIUPcdEbJ11pr/sb2R52ZtThtTiyZvrsTdlCZsbyCrF37up16EUy u6VTf7M9CxL3ImneiZivkNysSzwvbdZYSEiXHR6SyFqKJWta0m1Hfuo59Cv4wH1l0zHf QsmwWmoVWuOrkIQNTx38A7v6g96pbmh9NuY+GJ/ENXlZDkS6ml7jZnxSovcIBoBbTgVP E77WQI9pkj2Ld0MP5432zeBAqxB61DYDbDBdNx4ZLfw0DO1Im+hK5fM/WDLt78+w9Frg OZYw== X-Gm-Message-State: AOJu0YwPb7v+1BKTrVwjLATdNp74eLWtj7UUs4oKl2clB6RKcFLYq3Vm 0iUIodQZ1QyGoP3hYvfZOKwgbac6qlBw2IHnUfX21e0fJfUslPPtepUOrOUxw8pPnZVdNIS9M4h HliIJLmtpBu3aCphI5bLIefAKtg3goiHSUPF3Tfa+nqOQFDgdnIBS6POGYXE7PxSJkADZiFFCaR lBU7oqyitp4N0+yYeh25TH6A== X-Google-Smtp-Source: AGHT+IELhlKA+w5GoDYCQVGGU0Q69yO5Jt+Zri88wGQ6Nd2QAGecV+Ce7InAsjA0a+zrL4cO721qJjhh5w== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a5d:4f84:0:b0:381:d049:c688 with SMTP id ffacd0b85a97d-381f1884303mr2415f8f.9.1731082849389; Fri, 08 Nov 2024 08:20:49 -0800 (PST) Date: Fri, 8 Nov 2024 16:20:33 +0000 In-Reply-To: <20241108162040.159038-1-tabba@google.com> Mime-Version: 1.0 References: <20241108162040.159038-1-tabba@google.com> X-Mailer: git-send-email 2.47.0.277.g8800431eea-goog Message-ID: <20241108162040.159038-4-tabba@google.com> Subject: [RFC PATCH v1 03/10] mm/hugetlb: rename "folio_putback_active_hugetlb()" to "folio_putback_hugetlb()" From: Fuad Tabba To: linux-mm@kvack.org Cc: kvm@vger.kernel.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, david@redhat.com, rppt@kernel.org, jglisse@redhat.com, akpm@linux-foundation.org, muchun.song@linux.dev, simona@ffwll.ch, airlied@gmail.com, pbonzini@redhat.com, seanjc@google.com, willy@infradead.org, jgg@nvidia.com, jhubbard@nvidia.com, ackerleytng@google.com, vannapurve@google.com, mail@maciej.szmigiero.name, kirill.shutemov@linux.intel.com, quic_eberman@quicinc.com, maz@kernel.org, will@kernel.org, qperret@google.com, keirf@google.com, roypat@amazon.co.uk, tabba@google.com X-Stat-Signature: 9nkoxtom1fztupwpr8okz388f343fib9 X-Rspam-User: X-Rspamd-Queue-Id: A6A95C0012 X-Rspamd-Server: rspam02 X-HE-Tag: 1731082813-202023 X-HE-Meta: U2FsdGVkX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Zbo5ElHIOHCJlkDAN3/gFMjUNkDm0/+z0c3p2vz4E8BNfkV3/aplwpQZsG816T8SOXgA79/X+su5OiphQw+JQZ61rq6UcDMyEYVcTTVNdjJ8JuVmicp1nXrSBYLT+uK8+MpZ8zcEhr0JkG5kKkLVmhclVbv6j6z7VnMMTbrj3g5QzogJzvMN+MB05Se8E6lf5e1YxzNgL81c77djdPMVwEZ2kDz5CZGBecZpbP8zDT4ND1q1+PxvYC5v3qgGVrSdkK5QTtgLYiCIvgL42G5FTCmmfi58Q2jEEpyjtYaMzbiOux5yVvSCtMovkLOLHZwGWAmWwKzYwOJwYWGp/w2GbL7R+7CPqaC4/T3t9S2xmn39bRKgAdjSqgbTG3zRMitDiCuCo3ic7KPVH4brVEVv584oBFHYH6j6upLYAbYn0fv9mKE4rot35/DcKuKuIJBIxGCrPQUxUBYc4dvnwS3KEBttsvcpP+63zqibrCNO8lYHBBLKfF/atd+KDR1SnfrzZsWwLRjHjY= 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: From: David Hildenbrand 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 Signed-off-by: Fuad Tabba --- 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 b0cf8dbfeb6a..e846d7dac77c 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 da3fe1840ab8..d58bd815fdf2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7409,7 +7409,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. */ @@ -7461,7 +7461,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 b129dc41c140..89292d131148 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -145,7 +145,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); @@ -1459,7 +1459,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; } @@ -1542,7 +1542,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);