From patchwork Fri Jan 10 18:21:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935197 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 527ACE7719C for ; Fri, 10 Jan 2025 18:22:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DE5A6B00B1; Fri, 10 Jan 2025 13:22:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 090B36B00B4; Fri, 10 Jan 2025 13:22:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFE426B00B5; Fri, 10 Jan 2025 13:22:12 -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 B6CDC6B00B1 for ; Fri, 10 Jan 2025 13:22:12 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 72E8B44D48 for ; Fri, 10 Jan 2025 18:22:12 +0000 (UTC) X-FDA: 82992361704.23.AB05C31 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 5955880002 for ; Fri, 10 Jan 2025 18:22:10 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EABwLwbi; spf=pass (imf02.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.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=1736533330; 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=OXRC2m94ydMkiYC7QjOXtCup/ACjP0VRhTV9k+2JNqs=; b=CNZ3Xq3TEYp5YkBZQsQ21CWh8/TyaQvLXaMr1WIzGGW6ztIINWPPzKGbduZmYuTMfiYFJK OnN1bbDiwr26DZr0G2PNxpWfdHTvUteqpWk1ghMhgCisOjJxdqWz2Fyh7MqkG9eThlTUyn YZY167ju/P7+pVstkL/Tg5iIaWINqOM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EABwLwbi; spf=pass (imf02.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.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=1736533330; a=rsa-sha256; cv=none; b=TWqtpcG1ou13ngn6jAhpjjEFAdDSjNwgdpau2aKElaJ6fnWYDGoc+ONUxcgKMWyIZ64jE2 vabTscizhLeavPesgM3B6wzBVvDOIaunaPzJegZIp7F0WEOIivU84jE4Y+vsNeErGkA91p yobhxKsEB+tUJzwxNDLy+RlGYOGEmNU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533329; 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=OXRC2m94ydMkiYC7QjOXtCup/ACjP0VRhTV9k+2JNqs=; b=EABwLwbiPDBOjNpp0Z8qQ9LSpdHdFtzqPcUFUA9adI9JvN6W8Xx2wvbuu7dGjKUG6TCBsr ktoEGe08xKPXRw7Qs5n+st3o4BS8ZfBY1Slk5fNBJsl02/PpJ9dmiKrRsq9lqKu84eruPH ntLwN0txtnW5hQCL0FwipXU8BmbEzB8= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-SkGD3nErMN2_340x8xOq3g-1; Fri, 10 Jan 2025 13:22:07 -0500 X-MC-Unique: SkGD3nErMN2_340x8xOq3g-1 X-Mimecast-MFC-AGG-ID: SkGD3nErMN2_340x8xOq3g Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3862c67763dso921865f8f.3 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=p7BhitB3xQjIWXasmSSx7HRuYkvT5gT9mc4S8cROtHf06PhbKYg5fNQASXw2e+9mb+ t1jiU1Lka5Zbo7XpBSk0QjD9f7GLNEF2U/OlLG6jI6frlei6j3xnkQFbo/ANBhRYmCnM AOXWtFafla3FlOnKEqDaLuSbaeMx90uUgQWKym3B0/gG4kZXdkVzPtcHJG3hwqhSDaK1 t6xm+x06WhA31cLZwTgk8BtNhpPMpJt/66XA+h1whLqeJ3ddRXYPE5p7FhpcSjBXSNTF OctQ4VdQFYd0m5RhSeQgRYcYzNV0fvmQwbAovfADdgrKy6KfgOumPvFxHrlFfe64xZWF tHuQ== X-Gm-Message-State: AOJu0YwSKQabjrVHU9ALzbXTAp2SY/zK1hP9CyK2jApaHzlst0qd8qkO TUIO/WkKZZqtoRz4RK7f36l9nA+aHQ8hw4NxpuMJpAY54HXa5hXJAgXWV5lg/VjqvEqxjPd9OW4 dJb386Vp9cst5WDZEcXq138UWa0/AbYBXyNmG6RyvxFXtnhwcKKBrpqz4VdA= X-Gm-Gg: ASbGncvHAOz/icY0R7tqWeW8eU7mhio8QktDP7Bo0cmdlDr7YWef8GqAF9cSTuG2S5y l/YbSiapDTnABzpQ37g1IrCCgAJlb0pyqvQDRFluQtYDt3HonQBJpC435ZzK72IJZFrj7A15lqq EgknJq2xeOg5o1g33/J7gOZhMmWDSknvT+QKJ75OXkglOZQMVyl9NdMNKPnxIhSj5YAvdByiAwz vHsEeOVYaovL6u3eeMZpibxacxWypSauQWnNJbAYCYCOnHsglCKklZTjfVL9onYcMcaI3fW0JR1 cfh6P3VlERG6QJR2YKRXsBIbgFVf+PKQxm/Z4Ekifg== X-Received: by 2002:a5d:6c66:0:b0:38a:4184:151a with SMTP id ffacd0b85a97d-38a87336d7emr10411543f8f.37.1736533323253; 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> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eeWot85G0jR2RSzCiFM7dtiDdcAg0dqlhmMbc8k1GB4_1736533323 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam05 X-Stat-Signature: pkjs6tsxasrrbopaho8bsix7pisd31mj X-Rspamd-Queue-Id: 5955880002 X-Rspam-User: X-HE-Tag: 1736533330-155821 X-HE-Meta: U2FsdGVkX19e6oGR1CrcC6/dseWkZl4boJfhD4YqsrHIEpurg0oMxizm+rFtoPNLVydEZjijE1vokcNn5HOB/gbCxkrIPBiVeB480whYDLqY+ndHDAYfAz9XVJHRc9+icBjjLZDZJXnld3vidw6OXBYSVglyB7KM7vwm/iB4PJgi1nweiEh8m7iEc4zjQFi/+7a8OG/B91ivY5t4zsvCoe4kpeDPORNqsDIqtrwX0IoiiKqWpJbmg2s+LuwhMvQrNVS7X4U/s+DoJL4Vfdche6egbBD/26eqmeFUPL2ErHion91ET2Bsj2hc8HwGgqa6BqH8JSxZCWr9iu8GsxfStOnfILEdPyPdsokN4KRMvt/WgcJRtDULcyoUps9s8UX5gnAyA0JOF+Ji3x/OHdwJjMCro9SloyLtqPLCbCFSBSvyQdNk1mmFny7dgIDQeElENpNTn6ZtlnrB5QGZ6UWR1kRXyevIg33+rHPOr6w20uw1/JnHXKzGB9OrDNoxkBOQd5Bl8C/gIokkL2nqvqmhH86TubEVYfi0nUPkZTsfBafMK+9Rei2skgXp0bN6XTySENHEsL3XPsmqXAdi1VMJhVslvvxxVewYAnHYVhzb2UD8Q/Y/KE8jvOgEx8IzR6kH5HqhWxocc379spekYe5KyOn1ZOybJqrW8uEE7v4/87QWmiXq6YWdYDUTkroIXah04VVFhyfdr2rb8atw/WIMjB/dMVVpeUhIpg3D4fqASFkcsXoPYRyffynyJNwvxTLFBgul6jjn8P5jT7hgLPnfwJdKEcc0yLTwN9+ZHMjkDQ3foSNzyrp2oaJcEUhzM18xPFpwR0YGfCuOt0la/X0CL5Yp4LEodmrsY6wmABH9zh85ntXj/NsfYwDeZHW4y3Q9zMP81mH/mGgR+VrVW9xdWVCQ565VQhIovMtEJorcfOn40/ksKFsNOPnNo+35BdJz1aXjPUvTDzzwkR0cPHw 3OQJvt0V D+wPoqsSoezIM0XdR1fJeMR/IE1rvj5+RejIVIcZ4juNHYPKtLYly4UxMi+S+Me0NZrXC45zewm+/KDwINWSfcN5aXYUyb7QJocH3756ZilpJ/8MMDX7hTZmydCaPOWqPXDLUvMLCd+koXsZHz7fnqK582zAZreSEgNLuY8UeKOIeUNQoXeLVY2yRynIZgWYBeX8RHW8Fn8xsaVe2ALr3cI/NbcVKWtBYzoI5zKgLx3dPLB/bi4ptQqB+MMOQBvH47ay1fOdPBGuz9KB1AoClrbWjA5qj0CL6ODCHUrKPEiFayWfkpyH8NJF2kGMC4XhiMtELzUCpjDmlkCHr1ATHOAesSJKrXBLjkxkJv806mGPN9VqlCIxOh+PmkYjtMa+qKqQwBIT22E3WIat3gfxpEXaRo9BiGwE6Gj1YpWI0zY+OTModzdP2F5dKKbDheTvdJLah1o15YO4a2QzuH2NbTjE18deDQo9ayWAR 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: 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 --- 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 b24ccf8ecbf38..60617eecb99dd 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);