From patchwork Fri Jan 10 18:21:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935193 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 C5614E7719D for ; Fri, 10 Jan 2025 18:22:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D98036B0099; Fri, 10 Jan 2025 13:22:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEC786B0098; Fri, 10 Jan 2025 13:22:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B18AF6B0099; Fri, 10 Jan 2025 13:22:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8326E6B0089 for ; Fri, 10 Jan 2025 13:22:00 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 380F1120DB3 for ; Fri, 10 Jan 2025 18:22:00 +0000 (UTC) X-FDA: 82992361200.10.C09F5C6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 0C0B84000B for ; Fri, 10 Jan 2025 18:21:57 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HRfpAEcH; spf=pass (imf12.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=1736533318; 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=QDSAyCtg1fX0bp4z+4H4qfpYEbFsAwRyrL3Z8KQqD4k=; b=HI1SXveqns1lNlSYQKWC79a5nuQZptJJ+/Ywqz22drtCagXs2c/qL5fTttvQNUTKNQ3KxT YfAHftKIwUtlxJ4ZfsdMwnz0Tgv0iWhhKjjunB1PXXCoq61I+JxVbhbTLIXbPRhxO320Cb JymuvBrAyT2mW+TLC9JDlKh6GmHuXhg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HRfpAEcH; spf=pass (imf12.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=1736533318; a=rsa-sha256; cv=none; b=VvOWy51Vxk+KgXhxPvlKDHCmbciDTzKOoCmEM6QLr4vHGxCI/FlMf033DX8QBn13S69fhu V+vHw8kvvgtlcIJNkuPWM0s5l2Y2qRZHQZPM9y5o4kqeOm2i/+IFYuBNk8BgaZ2a6ZYlkJ lkFSGsAvDWGbzoREFug0i7RYG5YWPdQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533317; 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=QDSAyCtg1fX0bp4z+4H4qfpYEbFsAwRyrL3Z8KQqD4k=; b=HRfpAEcHs8K/M6ggC0x6XehkiQHsFpQ36okMFSaEDCO1N42/g46Q1xSasB1AAn6qVLXrtG FiijQ9xGiRkHZMc938RfZ0NDKs53A5MIMC6wd9iJZVndJNMeOG8xa90O92jVum+K1+3UtK OWvlO56D5oszBLD8NdiQ8+4BtH7fJdg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-BbkT2IdoMpuqWlV_vATsUQ-1; Fri, 10 Jan 2025 13:21:56 -0500 X-MC-Unique: BbkT2IdoMpuqWlV_vATsUQ-1 X-Mimecast-MFC-AGG-ID: BbkT2IdoMpuqWlV_vATsUQ Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4361f371908so16447365e9.0 for ; Fri, 10 Jan 2025 10:21:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533315; x=1737138115; 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=QDSAyCtg1fX0bp4z+4H4qfpYEbFsAwRyrL3Z8KQqD4k=; b=CSA06NEo8t/HoTf/KRpbLFNS1hgOiny3xu1nYTTPBAawqg3UEDf7YQPBDZme7FQnR+ WA2lbNVQW63XUc3EvPRaqNOS52t50NLgo4NRcdSKLiEvRkcnrqC+BWF8gWtDmGbnbD8M JJ4b1yr+B0FJLMz1XjMSMTRAKG+lfGOah2ZZK/N2Bgnfry1+gSEQqCfk7Wm7OZucahsK xlAStYPW/8DuwIW0lCGtHxNmj4BGoRDyhBC9Uoyg9uUCmw1oboI5JKCuXNSZACqEcjA+ 1hohjwI//YTTcJOaTdWCg0C3PW6B/XgKkltbIaun2PLIGzWz9DZ0ZlyN+9pj56U8N3WA lC9g== X-Gm-Message-State: AOJu0Yz+LzY+i8iub67SYmJ8yz+vAjXbVLWDagyhX5P1no+BmHvCvMXY vYw6m02hHozr1JvXY4qUY4FgNQOk/WhO0k/I4j9xh2h9XzkMqTZXF3tnkmDPdo3A0zb9WMdfINp tWPi2pj5ISKCi7dOeegMownTXVz6dXmuPWVS9mRTvRNHHMrwQ X-Gm-Gg: ASbGncu8GU3KuO7wZEVArLqrQfn4lSP6E62fnVQ7C5Xm+JAUKFPqr9IQa26BsFwIYwy qd+57orh12Gy24Bswe4rl92jr/rKteQEWFCdl5/d3JL5+renGRDBdSBjvcXwNE/jYPtuXjZQ5L+ venuaMFg3VtZv/nrNgLS5quFqph5QEdJkX9Ri4/32dAohcNd3+i3Sf4RaClNtz24ZYrIaMJhMkY XvfEJzjx4ZgfUzMm3lGRxNfBKevk2yJcR/u/ptq6R/Kz4uwMqWGLeoy2oU91V/993F8e149Gvzx jFUcqJcfGeV8DxtYlX9HzqhBKXPyjxyup85OdLw+HA== X-Received: by 2002:a05:600c:4fc6:b0:435:172:5052 with SMTP id 5b1f17b1804b1-436e2686492mr96784395e9.1.1736533314811; Fri, 10 Jan 2025 10:21:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEo3WdtgynR79gKF0TnPXRhuxMI+Oij1Fl43vOkRd3CWqDDLxRyW9C4c5GgRBUMq5QKHX25YA== X-Received: by 2002:a05:600c:4fc6:b0:435:172:5052 with SMTP id 5b1f17b1804b1-436e2686492mr96784245e9.1.1736533314489; Fri, 10 Jan 2025 10:21:54 -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 5b1f17b1804b1-436dd11ddfdsm77133265e9.1.2025.01.10.10.21.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:21:54 -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 1/6] mm/huge_memory: convert has_hwpoisoned into a pure folio flag Date: Fri, 10 Jan 2025 19:21:44 +0100 Message-ID: <20250110182149.746551-2-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: M4thZsqLTJLqfd6uT_jvmwgGMJ_dytBRza7C_GD5wSc_1736533315 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: 0C0B84000B X-Stat-Signature: u8axbmi3zwok73syk8tnkx9u8yjnkfh1 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736533317-125374 X-HE-Meta: U2FsdGVkX1+ZDXiBnbmdO2MwW2EOo/LgEKZ9k2qjwQKnzYZ+R0stwa4+5FjZO3ZvyVoopFfjHMkkhDIbKsa0lOyDGToBKs6je9WCIHj+W3TC1H+sIO87Y0wNr/GAlMhpi93BgzmqqJBGKGW54a5JuQO3JuMJBGmNNyPeFI/laYiJ5fZOxW+uQIgN5eXG7STewKTafqA5WSHRmMtZh/LqXLP62m5U9xO02eS4+1s564iYLwj5CENZxJVRD2DwdV5OmBfmxtBdrGPcvjHrd/RpJBlCTXobD8/tKiAk6Z3hYEYvcEcre2PkcwxxLjtxrlx7gBKZIj7fK5bvzJ4gfC0aa1skmCtXrxg+VwZPpEwYrIuWgmfORsWvuf3iIJ+x4Xx+moFBDQ69wex8nQ+XYDhmCudr/HapfRaDtgfGvnjz5028Z2UmrtFtrIHhuFN/oxvzBZfxSbnJSpIToar9AoP9G5wE23y4v2ag/zQxQMoYgowSL+mPLylSeCakLTVl/Uwz9Bp7eTYkam/+dSn2zu0wm6+HClbsr7EK2BaEhq5e5O0Xna5YtJvGQIhIi+9tOrlhstAA5Ns+d3UEbq/NaJiMcg+Y86vSbRQRJ+0miES+CDsrgRTOOz2/0dLqWO4+h3rxvQECl9KCyLv8x9Aqnd1XoxwmjrJR0E2Zn7we8p7DBAUXcrQnC9y+nWi2oNORZ+rnbtlG+zyr8yfMPdGkBSQTz94b37uU0xt+rMHHORXAvK6uXxdzXyniGnJqjJ5QxQmDS+EA1LC8SkvhmB8i1clgq1sZSF85AvXD3Bjh7FpCrpUwv9KILyVKaCDy+uF7PUu6lhybbLBBK+jFQAxGMaL/HLClrk4B8ojBXfXMLXosp4VgE1RjFzEa6oaxlYrBF4c+Mnn1EGqwwKbLeXoR7cugN6i9ODCLT+4X8l4nkwQv8dT/YpeTBPC3xewQWtMwnHW4srNCdnAr6xnJ2fAsbTs DuPphnuY FL2ZUQW/fzxEjKaGX9GB8Wa1RIJMwsD5N2tdQkVJ4a5if67y9uoFra0EhmDN9Kftx+sGU9iUDTkDokBhTGtgAcg7/YU2+qbH+HR44Gp/czb1WVE6kGZK4GWG8nHR9uFiB0oSG0lLwVn+qPeYuFPMPzI6tJ0Ibj7++wkSOgkAoViZk6jEB8fXWo4PnS1m9jI6IRqywyxYWx8jnlF9kpYkwQN4uhrP/YgQdfabDal6XRlaaLdzTJC4Syp9sAoY1h7eSq/55wxuvY4kQqoSqWYNgYXryeGQDHPk629vzlZCLg5EQyixzSs4xuWad3BOpi5g2jcXQ97jaYAVv6tWskcn6+kj3lZkRPJSxPFiWflh55wfyTeI6DTh2Lj+lZvPrPO4csMbSHwL+hhFLWZchw4mnms93pAQq3RfV29tIOfJLCxNJ4yFHFmlHYYKbno5QbsGabsRTqUyXx1enxf6d7fKf8OGBJ0nmJDSoAlb0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Let's stop setting it on pages, there is no need to anymore. Signed-off-by: David Hildenbrand Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 6 ++---- mm/huge_memory.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 14226d6bd6f84..3f6a64ff968a7 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -948,11 +948,9 @@ TESTPAGEFLAG_FALSE(TransCompound, transcompound) * * This flag is set by hwpoison handler. Cleared by THP split or free page. */ -PAGEFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND) - TESTSCFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND) +FOLIO_FLAG(has_hwpoisoned, FOLIO_SECOND_PAGE) #else -PAGEFLAG_FALSE(HasHWPoisoned, has_hwpoisoned) - TESTSCFLAG_FALSE(HasHWPoisoned, has_hwpoisoned) +FOLIO_FLAG_FALSE(has_hwpoisoned) #endif /* diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 2654a95487499..3d3ebdc002d59 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3290,7 +3290,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, /* lock lru list/PageCompound, ref frozen by page_ref_freeze */ lruvec = folio_lruvec_lock(folio); - ClearPageHasHWPoisoned(head); + folio_clear_has_hwpoisoned(folio); for (i = nr - new_nr; i >= new_nr; i -= new_nr) { struct folio *tail; From patchwork Fri Jan 10 18:21:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935194 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 06B60E77188 for ; Fri, 10 Jan 2025 18:22:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91C256B0098; Fri, 10 Jan 2025 13:22:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CC6F6B009B; Fri, 10 Jan 2025 13:22:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 746126B00A7; Fri, 10 Jan 2025 13:22:04 -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 4FA6C6B0098 for ; Fri, 10 Jan 2025 13:22:04 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C9EA780D4B for ; Fri, 10 Jan 2025 18:22:03 +0000 (UTC) X-FDA: 82992361326.14.3B28080 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 98DD2140013 for ; Fri, 10 Jan 2025 18:22:01 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QKf4rW+c; spf=pass (imf23.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=1736533321; 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=tRBcf145a4wbVi9jTDlwWferknOn1sr5Qv/yEdUMYsU=; b=6UFCu0tHBNTnIGnMAcpU6lS0Sk2HbaA+R4EW0YSs/UVVyoY5irekoLId8ToMoJ8SAFCjJE AYHlAqsPV13G75ZscKAm3WUAX6T8XAAZOcBPJdSeTcyK/KrzqfQL92jpVLYwarktSw4iUZ 5MmLW8TnZbKD/ZtUxoOYxX3jM/pWPzY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736533321; a=rsa-sha256; cv=none; b=3CUlUvyYfBWYhjHZJfxcO9stKHeW8CxaMZiru4EZZxGArAq0uXZCVJrjUpayhwKdqPLm9x De3rlM9zRTyQihfPIAzElM5xzyDqAaAnxZnjlhMmGfUNizRtsoNEd/B6hIfw6vvpi6Q89d kDmGkzjEZrWbIbVZv4r3c7lusv4dHCs= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QKf4rW+c; spf=pass (imf23.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533320; 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=tRBcf145a4wbVi9jTDlwWferknOn1sr5Qv/yEdUMYsU=; b=QKf4rW+cFc2LpEvb0cOgPe/rzjdPcHujpwMGJB8tp+FD9XJv1oha0nYG1u2iHb6o9V4pJZ kP/o/rTmkkAvwOJqfn+bSBc5dgzhomcNXADVQ5Rec+teIB0lq5iavK+1ppcEtnzcSzMuWU E2kcdkvmWFgEqaqhl1MFywMCcRcIkWo= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-lsFDSOTRMtGtqJv9TcARDA-1; Fri, 10 Jan 2025 13:21:58 -0500 X-MC-Unique: lsFDSOTRMtGtqJv9TcARDA-1 X-Mimecast-MFC-AGG-ID: lsFDSOTRMtGtqJv9TcARDA Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-38a684a0971so1013053f8f.2 for ; Fri, 10 Jan 2025 10:21:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533317; x=1737138117; 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=tRBcf145a4wbVi9jTDlwWferknOn1sr5Qv/yEdUMYsU=; b=ABkiidoQLvz67Cf8RQviaIswJb7Zwy/FlTaLGhzJlkpNCRqDonlUcrDDVrfKsuHHcD suK5oq+kmdjdAQsMoAqsI54nPrYW8+x+E+EUUVhaunLmSEhMgEmuWZ1KBI/Wl2LpL+Dk TYrBoaUD9L8UNp73iKo6BtdpfISUav8hp8BjCvk77vjitQ7xXB8YC63A5sP2g01V9FyI XoDo5ghlZE1AOGu/v7TPufBkKFRCG6ltvpCwOE7iUW/2sBVVwfAjtTykTQp6zXA0/x0n 5uwwduylQjOHRhBfv8eHjjl+8ElD7q7M5pNPQu1A77DdJHBpkln/Gxt8QhoENetaE9MA 1FcQ== X-Gm-Message-State: AOJu0YzZjNeM4usDDGIL9Vn116sqlTRZ2RUZzqVkRnpOnj6E0a/7tJie lFMg8y4TWyBgJWOroHoqtF2OfwN5rAXvj77r78EQHsqhzHEgwfItILlUABpKDdk1al0Gu56lp2j GMjiNKceyIi8Z0c587J4+PgIqXhV9DwLBUBBfOgVjugjiQMLt X-Gm-Gg: ASbGncswN7+nJBDLFj6ztx2C4MIA0bjyGYGi9xxHczDcQW0EPX+z1MBcL54KToY8LTp 98+ftGeFh0amvQAFAA7V6WPOKFbnFvqVfooKyR7tE+TkJmtCVsavzf9hJCdZFoixPS/wE8nwidU P40Zb3YFrL44Rj2PY/xn+fVhrkhcmmuMiWAm6aoMKp39ZVgdcHTABzKTtHr1pyKbrnIbW1kRYDk ZTakjdF/w1+/Z0fD6x5WCCGtRJpEYbpAfg2GrsHzZ8aZVCyjlqiIVrnkC2ws2mSib+LPIGdqb3R 4gdGdfs/jpGlTcjysFlv8Vr8hkaStQJ3yuvmkNhzmw== X-Received: by 2002:a5d:64ce:0:b0:385:f092:e16 with SMTP id ffacd0b85a97d-38a87358eaamr10067250f8f.55.1736533317608; Fri, 10 Jan 2025 10:21:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQVVcAg2GfKFgY/NCz7qN+LDaq6+VWQgH7WNixvGBrnqPMWFIuBEKOik8O9disKHaGf0f0SA== X-Received: by 2002:a5d:64ce:0:b0:385:f092:e16 with SMTP id ffacd0b85a97d-38a87358eaamr10067233f8f.55.1736533317258; Fri, 10 Jan 2025 10:21:57 -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-38a8e3838a3sm5187851f8f.33.2025.01.10.10.21.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:21:56 -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 2/6] mm/hugetlb: rename isolate_hugetlb() to folio_isolate_hugetlb() Date: Fri, 10 Jan 2025 19:21:45 +0100 Message-ID: <20250110182149.746551-3-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: v1MjA4yB39K79Wc4XZSAaum--x4tssrMJ2CPTewlEjE_1736533318 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 98DD2140013 X-Stat-Signature: 8564cxqwqwapxcbs6qm5g7x9i3ijiae4 X-Rspam-User: X-HE-Tag: 1736533321-259952 X-HE-Meta: U2FsdGVkX18PpTYiYO6r1MAXo2agUpm238XMxkeVhT5+uKnHvGNVu5rEc9CwIy695/QG/L8ScCmWA2xtRDFPnNaEAz8LYjyB21x5tDQ5AbsWttN7JuAbH68zDDPxU4byAUjprZsCg5/vsxPFIUwjc9E98WgGuff4pMbkVGXLLMHbqkXLj76pWBhG6nOxEnAhgFSqDCUuoRPsjIW2CQj/HnLy+WL8ne2QFt4GxirqAjYQur37h9rKXuJYFIlc2AkTF0oQVbQ7fC6mZC9sEgAVy3UipIYyKZdIoYI5cOgqSLGQLWoTiDOOxE2y9Bstaxt0aWnyMSxfn+7mzD0N99lx9YU3EhbgJIvSAwswIkWsbY7uEM/u9RrNDcUwfb3+ajhg6yx03YM4rfHoCLLdAalmOu2oCzVPn4VaNggXZZ1+CXyaxCifVC6TnznpiUcONP/PwHrU5yd+bLARMbLaV0sO10ocXl64nhCg8/1qtvflc0XDAU2cPrPbuEPbZq0MbmwZB10PPBbK3LG7Zpd9B3fZn0uOE+k/o7JJGhqarK4UCTeVvrqMzjs1Xf+tjPuELM/r8gELqwrTqwo5nKyJpUj+cvh6sdF1tdXSnQe6NOYGlYvhZAKEBJf7eM/aRu182RmbRub/4XLl0w6aC/aptZpn7ZK0HuXjjpqysows8hyt+eeRliG8IoEoU8me//b6AZ+Q/EOzMyEMGlvsDzjM0bTYfZNF7stmWwd0A69g3n1nyLzBv9rGrijRBYePAoAwWbaN6/dFXBqNQ2PxG2HR9gUUUXrNLLGgFU9bRDbg5Bet8IN9lHsJqO7SgNn1iKD+rs56bbluv1zUQrP6GgDM87sh3NzEfe/oaflPcHW34hv+15nZNYBH9m72gT2KM3xyzvv0skaIIyQO/BrmIbjq8BUwKFU27maJSAQfVEVGbZkGNSiQnKZqYPkFqs6fRYrD90t6Am0xkIsZGyqSvk8mW42 ecKU2b4F gL3X+l3HVU3CKWW60tYScditpKCLqojgQLbxRtWW52CF6JRKaweWvECfN6TCgvWqv7ti+Fx5LGt4HOHl+EDgoE0CQ9rsl546EwkZLZkizlrDiX4oxSX92TR9HuG0LguuteYsahj/F5d3Zc7I0fcsDewV+G9J1hyGRrD60ziWLYA9erXtxKMVLxYzXf78zteIzCrHe+GTnxYhWjjaXbsh5VT5KZ3qBU0HQ23GlD8q/8Umy5T074+5jhiX5MjmdgBsyQs3G+v4kgKYczX0H8160QJdxPc0nJmQCdKrRZhxpNVQue/Na6YucUyj4nVt8oh4PWwhu6JXl0dIq7QonhBZzKe0l8qejSd0GyC+dt8WItTLM3eQvXxp98vErYgZURNm8k44wzmcz0LbU6vArwA6EP9wSixWW6CH95yuMrApxhm7IhzTp7Enj6tU5LLltSXgKIYWLyuOj+6hNzqZ0q6gtYMEqYbP/RBX1jClG 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: Let's make the function name match "folio_isolate_lru()", and add some kernel doc. Signed-off-by: David Hildenbrand Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/hugetlb.h | 4 ++-- mm/gup.c | 2 +- mm/hugetlb.c | 23 ++++++++++++++++++++--- mm/mempolicy.c | 2 +- mm/migrate.c | 6 +++--- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 49ec2362ce926..c95ad5cd7894d 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -153,7 +153,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to, vm_flags_t vm_flags); long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed); -bool isolate_hugetlb(struct folio *folio, struct list_head *list); +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); @@ -414,7 +414,7 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, return NULL; } -static inline bool isolate_hugetlb(struct folio *folio, struct list_head *list) +static inline bool folio_isolate_hugetlb(struct folio *folio, struct list_head *list) { return false; } diff --git a/mm/gup.c b/mm/gup.c index 00a1269cbee0a..2cc3a9d28e70e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2344,7 +2344,7 @@ static unsigned long collect_longterm_unpinnable_folios( continue; if (folio_test_hugetlb(folio)) { - isolate_hugetlb(folio, movable_folio_list); + folio_isolate_hugetlb(folio, movable_folio_list); continue; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 9a5596022c4b3..da98d671088d0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2808,7 +2808,7 @@ static int alloc_and_dissolve_hugetlb_folio(struct hstate *h, * Fail with -EBUSY if not possible. */ spin_unlock_irq(&hugetlb_lock); - isolated = isolate_hugetlb(old_folio, list); + isolated = folio_isolate_hugetlb(old_folio, list); ret = isolated ? 0 : -EBUSY; spin_lock_irq(&hugetlb_lock); goto free_new; @@ -2893,7 +2893,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) if (hstate_is_gigantic(h)) return -ENOMEM; - if (folio_ref_count(folio) && isolate_hugetlb(folio, list)) + if (folio_ref_count(folio) && folio_isolate_hugetlb(folio, list)) ret = 0; else if (!folio_ref_count(folio)) ret = alloc_and_dissolve_hugetlb_folio(h, folio, list); @@ -7417,7 +7417,24 @@ __weak unsigned long hugetlb_mask_last_page(struct hstate *h) #endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */ -bool isolate_hugetlb(struct folio *folio, struct list_head *list) +/** + * folio_isolate_hugetlb: try to isolate an allocated hugetlb folio + * @folio: the folio to isolate + * @list: the list to add the folio to on success + * + * Isolate an allocated (refcount > 0) hugetlb folio, marking it as + * isolated/non-migratable, and moving it from the active list to the + * given list. + * + * Isolation will fail if @folio is not an allocated hugetlb folio, or if + * 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. + * + * Return: True if isolation worked, otherwise False. + */ +bool folio_isolate_hugetlb(struct folio *folio, struct list_head *list) { bool ret = true; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index f83b73236ffe7..bbaadbeeb2919 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -647,7 +647,7 @@ static int queue_folios_hugetlb(pte_t *pte, unsigned long hmask, */ if ((flags & MPOL_MF_MOVE_ALL) || (!folio_likely_mapped_shared(folio) && !hugetlb_pmd_shared(pte))) - if (!isolate_hugetlb(folio, qp->pagelist)) + if (!folio_isolate_hugetlb(folio, qp->pagelist)) qp->nr_failed++; unlock: spin_unlock(ptl); diff --git a/mm/migrate.c b/mm/migrate.c index caadbe393aa21..80887cadb2774 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -128,7 +128,7 @@ static void putback_movable_folio(struct folio *folio) * * This function shall be used whenever the isolated pageset has been * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range() - * and isolate_hugetlb(). + * and folio_isolate_hugetlb(). */ void putback_movable_pages(struct list_head *l) { @@ -169,7 +169,7 @@ bool isolate_folio_to_list(struct folio *folio, struct list_head *list) bool isolated, lru; if (folio_test_hugetlb(folio)) - return isolate_hugetlb(folio, list); + return folio_isolate_hugetlb(folio, list); lru = !__folio_test_movable(folio); if (lru) @@ -2203,7 +2203,7 @@ static int __add_folio_for_migration(struct folio *folio, int node, return -EACCES; if (folio_test_hugetlb(folio)) { - if (isolate_hugetlb(folio, pagelist)) + if (folio_isolate_hugetlb(folio, pagelist)) return 1; } else if (folio_isolate_lru(folio)) { list_add_tail(&folio->lru, pagelist); From patchwork Fri Jan 10 18:21:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935195 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 EA279E77188 for ; Fri, 10 Jan 2025 18:22:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 572206B009E; Fri, 10 Jan 2025 13:22:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 521DB6B00AB; Fri, 10 Jan 2025 13:22:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3751C6B00AC; Fri, 10 Jan 2025 13:22:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 162806B009E for ; Fri, 10 Jan 2025 13:22:08 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 83960140D71 for ; Fri, 10 Jan 2025 18:22:07 +0000 (UTC) X-FDA: 82992361494.19.E9D93A8 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 5621520009 for ; Fri, 10 Jan 2025 18:22:05 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TmsdtC98; 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=1736533325; a=rsa-sha256; cv=none; b=oQy1F4WC051k7BiQUGXIoFDdbDl/Otr+48CGyzEQJJwgDFYsaCrCq231DpYvjXR6Mb2YA9 Xv6L8hFc6DIn+org4fKPhZO+0oweBb7xuhQtMliCBPEXIAkJqMUMAe/5W70/o1MoWRwysE H1/1S6Q7v7E+pmwYjHy71pWThx1PA3o= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TmsdtC98; 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=1736533325; 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=v8hq4g4DhybxUwRn0BKWdtx8BUqV1Iw/Qc0FsV0dDNg=; b=tvDu+oFjsG5WPlTHHIe0QNRoT6OBVvvfuYerRczHRY85ONsk6Y9KaLYFxUHfdFSIQrPb6+ 7TiAicFOM2lZppRN9JMEjDocm1xOvYhfSWgigCMkDAQL0gqbbQS3eLlViT3XYcEEcBNEVf OaHn1S6AuwEQevleWEHTcPcJDTCke7Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533324; 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=v8hq4g4DhybxUwRn0BKWdtx8BUqV1Iw/Qc0FsV0dDNg=; b=TmsdtC98/7EgPUcLWdfykzomIRsDMpWhqn/BfUe2i0DZgCCjTSzsHuJLNwNGolCE23VzkM JqOLQGwZ9eAifEEMcWZHLW52BgB0VUHmanRvr63w3MgjMyv+MGVulnpavjiS1sBEwsLQhf 0sZ+5RJa5ppuy/PglTgXfdoVtq6Uzcg= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-VRo1bWPjMzy2uOKlhvB6fg-1; Fri, 10 Jan 2025 13:22:03 -0500 X-MC-Unique: VRo1bWPjMzy2uOKlhvB6fg-1 X-Mimecast-MFC-AGG-ID: VRo1bWPjMzy2uOKlhvB6fg Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-436219070b4so11425945e9.1 for ; Fri, 10 Jan 2025 10:22:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533321; x=1737138121; 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=v8hq4g4DhybxUwRn0BKWdtx8BUqV1Iw/Qc0FsV0dDNg=; b=RpYBxAC64W+YC4z15z8i06DLKL4SgiIETakrv/eMzsSgGRcxrKJlH7wxHd7ABceNkB VTFWXqe8qcI3w84ZMmL4VG9FpkMcQCRH63Z/R5DZiForZWF36nkkKdMZjjml7fk5vRpK G2SVDScXAY8vdiEVf9J8lAWDbl4cPYuTajGRo1iWdq76Gwj/flm/0lYQv+NmOtBVXDYt z5JxQEBnj+Eu3CPOTLtiy+iAImYje1KgiOSMRdUWkIMTi4qDymRomqntz8lUHdYEHeS7 5dRBA5HqRnO25oY9QqyUj4oY1e2iTGMZPzMSq0O28G/2mVncm4tnGqS1CTCWN31EJYrO 7mJg== X-Gm-Message-State: AOJu0Yyfjw7h5RCSLQSljbRODtdvWegI8/dV2t27NP2O98aFE56iFx1g 8gJfO1pOd6L4q7S+LUnpSqKRCB3bnv/FTSynGgMtWnYGZh7qX1c+6ZruiH0WiQrGiy4vyYXSYlr EPg0zhv0deNWgKEywEnPmyCSYs1DXDDH3N9GBzLupzd/0qIeP X-Gm-Gg: ASbGncs1SzuP92BXhLvIgVFkKBrdtTQDcsqXQ5iDMXTMwL7RNAspsSSm8F/Ns3SIBzg Bo51ACRHBAMMDuroBrIbEufY6+X2TczhluJG2wrswm230xM3fVOk6ymJHARWhiZ/BpOfo7wCwQl 1cyjo1g2BUEq8hyi9HPwKmmLPMT1FZG6bRw7cJkSO7Tvss3qbEf/M2piP0DZJyJGGjmZEDe5IeO OLmXL2D/0Vv0smQ/mlJzrnQWfLWw0w+EfY3FeAl38kufXO2egB26Zbr5W9aG/EU0STTV3IlLiN3 TUX0Dsha/KfbvKgmgqpdKGQLgJXen2rNUzRdwJuuTw== X-Received: by 2002:a5d:648b:0:b0:386:3e3c:ef1 with SMTP id ffacd0b85a97d-38a87312f36mr11978772f8f.35.1736533320869; Fri, 10 Jan 2025 10:22:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsNI1nT/mSiB4lNoNG7hpy+n586x8LDR/iUFuGNavqE1Zjg9u3TYOy+Hd2kEulLAgwJ82EoA== X-Received: by 2002:a5d:648b:0:b0:386:3e3c:ef1 with SMTP id ffacd0b85a97d-38a87312f36mr11978752f8f.35.1736533320488; Fri, 10 Jan 2025 10:22:00 -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 5b1f17b1804b1-436e2da66d9sm95077415e9.1.2025.01.10.10.21.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:21:59 -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 3/6] mm/migrate: don't call folio_putback_active_hugetlb() on dst hugetlb folio Date: Fri, 10 Jan 2025 19:21:46 +0100 Message-ID: <20250110182149.746551-4-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: kljD0gmhiXJd7mMP7MY3jeaKE1AtOIu8EfyYSGEK3NE_1736533321 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: 5621520009 X-Stat-Signature: dnjxpwjsq895rbx1mcbfk3xtej3zyzsj X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736533325-416111 X-HE-Meta: U2FsdGVkX19tKsH+hW6LHJq2pd2Put8LExpaI/sGL9j6iryM/uPyLhXEHgpYKs7oAmt/p0OyINGHYkm17mkroMHnTz1V8qij71QMkgall5VZh4kDO8kikwRvErBLPkO4Z9Kr9ox/hcUfvQi5M7lyBzNMj+Lp0IWtIs7XhOXgVN76rHu+4WvW+Ldb8rEcxyOkDE9pJxfuIYIbexcQ7XacI5mJlqANFCSWYlQthCbOisquU2YisPD7Y2C89tc6ZIWdzuIA9/6IB/JkBidLd4oCYedOotS0mAqiRfoEjqoyxXU42u8SNS0cBE1NYzyhmkN1q12lT6j06SjVCBMwtPJgt/wGi1lv6xqI1UyMOEWMJ2uzJIkV+c6RbnHZykF6c6mwXV51KKRXZgcm1U/gpuCaCPRLJu01g97/AIvoBJo/gIFchWxZbVT6zfHLHzMRqrnNjYfhDperS6D1lV7CodtfscG6xO9no7JK5WcUh/xzhrWd5eRg7bnI2yqXVYTBogWHs6BmfBh7A+BgMdh9eLatnuyPp0BtYJa6MBlpzDN8X5EYik0FgDi0xvvg4moM1LvNEA3LrX9k5srQIMC/5RWXKCUh/EXw+YLxrfQ1tOhJMRhlgyF1QMCVIDLxFEo18oc+CCaVDY838QSc7sqUW99n0rKKLtqEXFLWvk1+VuD7MHf10duwwWejFfuydhjPsybX+PV40kmF1nmW5/Lmg3N8nyjF3tli/Jb8e9dHDz3tuX5ZxhQg1NbUUbr5DNZK8uHInOaj+CAqGXmmXGLrcJpy+pbCYOxQptt79Q0V1JvFGfgwelQGlGdwOvd9a1vlgKRa2lkaYFr666+aaAOI4xX6/jiDgczUuxYP2bF0v/Ypg5pmxMeVtJcxEHyCgYU36WYw7KPc8vEnX/SwCmKvKBsr7jRwj0q9es2BwDiR9OT9hO0XksTq4GiNa2c2xRzTALH/C/ooKdfZKdRM5F7tWsU xlpq2EF8 4XpBMj4jXExicKfOYyHBWQmKXerre3nBK2O7ULKeXNS8D9bUocFAmMW5FiGlyrm9206kKgUF6gMuWRdIdSY/bBkerNYRZOEZS0xTyeVlR33ZFn0pMBa+cNKiEN8sjIN2MgGeEAjey7YBXastc5fGCjZJSBI1IYxWmnR+flooWy88B9UxovoL1d+L22/6HEzjWY7qSPbq6mNy6iOFkLCYiX/MpNBYedgUyzLHZ8eKpZvvsd1OjdOzFuSbTp8FGS4ccVBEJS0Z8WzR6kRtYAjwzjcgDcW4jQSyf+dA/8vvDN+8pJCHA+yqAvqIg8+TfKel+DxblwhfgPyt4jKk6eTXw0hp8vQqcONdxpC4SdPK5+laSibX1MJNWa1IYeJO1XUlXJa3eIgWrieGiMcItmgrOjhTPcPj76bQaQEA+l2oRWyBdY/grnZX/9dnsHpMcGw2UzAkRURT59tzOHG1e6QphR2QHhgx+zNgjtpOn 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: We replaced a simple put_page() by a putback_active_hugepage() call in commit 3aaa76e125c1 ("mm: migrate: hugetlb: putback destination hugepage to active list"), to set the "active" flag on the dst hugetlb folio. Nowadays, we decoupled the "active" list from the flag, by calling the flag "migratable". Calling "putback" on something that wasn't allocated is weird and not future proof, especially if we might reach that path when migration failed and we just want to free the freshly allocated hugetlb folio. Let's simply set the "migratable" flag in move_hugetlb_state(), where we know that allocation succeeded, and use simple folio_put() to return our reference. Do we need the hugetlb_lock for setting that flag? Staring at other users of folio_set_hugetlb_migratable(), it does not look like it. After all, the dst folio should already be on the active list, and we are not modifying that list. Signed-off-by: David Hildenbrand --- mm/hugetlb.c | 5 +++++ mm/migrate.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index da98d671088d0..b24ccf8ecbf38 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7529,6 +7529,11 @@ void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int re } spin_unlock_irq(&hugetlb_lock); } + /* + * Our old folio is isolated and has "migratable" cleared until it + * is putback. As migration succeeded, set the new folio "migratable". + */ + folio_set_hugetlb_migratable(new_folio); } static void hugetlb_unshare_pmds(struct vm_area_struct *vma, diff --git a/mm/migrate.c b/mm/migrate.c index 80887cadb2774..7e23e78f1e57b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1542,14 +1542,14 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio, list_move_tail(&src->lru, ret); /* - * If migration was not successful and there's a freeing callback, use - * it. Otherwise, put_page() will drop the reference grabbed during - * isolation. + * If migration was not successful and there's a freeing callback, + * return the folio to that special allocator. Otherwise, simply drop + * our additional reference. */ if (put_new_folio) put_new_folio(dst, private); else - folio_putback_active_hugetlb(dst); + folio_put(dst); return rc; } 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); From patchwork Fri Jan 10 18:21:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935196 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 6F89DE77188 for ; Fri, 10 Jan 2025 18:22:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE91E6B00B0; Fri, 10 Jan 2025 13:22:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E705A6B00B1; Fri, 10 Jan 2025 13:22:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC5656B00B4; Fri, 10 Jan 2025 13:22:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A69096B00B0 for ; Fri, 10 Jan 2025 13:22:11 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2DA07A0DA5 for ; Fri, 10 Jan 2025 18:22:11 +0000 (UTC) X-FDA: 82992361662.08.F192796 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 0330040018 for ; Fri, 10 Jan 2025 18:22:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DMjBiTeu; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736533329; a=rsa-sha256; cv=none; b=Q+QJajN+UTQOXkc5VCkHny2txGkO9wDQub4BHxyhHOrJgam4YQbkLocMICcCW7dxfnQdV5 xghaQLC9MUzjveJKlyQz1oXJvOds/UW9EnY79XqT3apKUY2HV1ejZdOVg7eXjCHoD4EkGn w0uhdTASGeT9y7HpzdQDtHwxBE4NeM8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DMjBiTeu; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736533329; 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=7Y6jXgybxRkLjI1AHQdA/uUdE381WdqnkZcDYSI/y9A=; b=nQGl3vLDJQiToCNbHe6yF+r2nrDEOpPywqftwF9PllCLKKQydr/3BpBIO3CxYnOCzoruED DjJr90znUhIEXHya9wla6bstcfiHmyjg+izaKAExA1/xu5wsr7ihR6MFsgarsNUbsIEIOb Vd1cAk9mFK6iZlEegmpeNTk8eyidNgo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533328; 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=7Y6jXgybxRkLjI1AHQdA/uUdE381WdqnkZcDYSI/y9A=; b=DMjBiTeu2UBgD0g7++rFhaj/0JV1e+CaGurvRaeKCDGLra2jwmD+HDp/2n/qtiJ6LThw0m y++UFTGJ94KdR+/oHyiZbGRtv2ALANw3ntwPpjouQE6ZRRMpJ9GUG3/f4iANqcoXAStcCm tQAuVbsD4K1LnYu8T5r3SGJE0x2SfFk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-116-9wxVbD_DOkuklWIWwdwfig-1; Fri, 10 Jan 2025 13:22:07 -0500 X-MC-Unique: 9wxVbD_DOkuklWIWwdwfig-1 X-Mimecast-MFC-AGG-ID: 9wxVbD_DOkuklWIWwdwfig Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4361a8fc3bdso11985895e9.2 for ; Fri, 10 Jan 2025 10:22:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533326; x=1737138126; 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=7Y6jXgybxRkLjI1AHQdA/uUdE381WdqnkZcDYSI/y9A=; b=g+AwTrevRpdHH3m2EKVvqNYfussUtLbt99tH7LAmfLNeRMbgv4O2OV7w3vvtJB9BAr 5ZetxSXmK6OxQsz95Lpn9i4iqW5eOgI7q88HXCCzHf2rwogZu9a3MC5MqOKe+HzsYuB1 r8QotbXf2pw02KtD+UigGcCmmcz+O6JCLqetu64I51NTeOIO76GkZd+ZZrPZmt6FcqO/ qt9dLkKAk16hc+mkpkuovOIeffyOhvv/3AvRgfVLN00CwX+GtVRDjqzSB8jvOUllG9Ku na3xZoVnTFrzgsTIUW8wWhuWwEEvHB3quUPJ9jIj69lZJ4+7G+8rKX3tv9TQ56PTX1NH Mezw== X-Gm-Message-State: AOJu0YxShQzv6SnWMXeideOJhAZ7Ff+IMHNxkV4Dx9eGecS87R3Jb+AS b6qnvRcrqEsVGA4G+JD66PbFJXZ1jryT6hyX4qhk+AMP18iV0D6mqpKrr5KLrESWOqDnUBVoFuK 7Gq4OPZVeG5C2MUVKOIgnZRgFC8LWSJ4f4mD7DJ6dG3w9C8hd X-Gm-Gg: ASbGnctlK+/6WaoQ31Em5IDkFNmerd0/YMAGqaRNk0SICvEOi+aUYtzUCkuQgMUbRee Vw1lrONkYvy5kJobzCE/2NaNwd3Amm2ZR3vtko7x2A9l/zeLYckJ2qvvTdm29S78WQSHCxu0uGM c6zFW6SEVOL2xf67sq/A6ZInjO91RFd+5i/ylXRHbOvNjI6C4L6us17hQ54r8OPEIWk67xeXMic dMHJ8WiQZzIOjMngLs8b+/zAZ6sfKw7z1GClbbTO7NpJbEs2bqzqD70+Y/D2qUEEUH86bEZaudF dqc6tB0/IOBijqQRaQL9aEgsnpRQAFR6Wr/3ztOofQ== X-Received: by 2002:a05:600c:138e:b0:431:55c1:f440 with SMTP id 5b1f17b1804b1-436e26f5f3fmr121514265e9.30.1736533325717; Fri, 10 Jan 2025 10:22:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfyPcq4pW/J8BG/r5An3xGWFuEtFy8aWLFQ30egdSLXBVyBhWxqaKAHMz46OsWfBiI1GqFlA== X-Received: by 2002:a05:600c:138e:b0:431:55c1:f440 with SMTP id 5b1f17b1804b1-436e26f5f3fmr121514035e9.30.1736533325352; Fri, 10 Jan 2025 10:22:05 -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 5b1f17b1804b1-436e2da65a3sm95656095e9.7.2025.01.10.10.22.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:22:04 -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 5/6] mm/hugetlb-cgroup: convert hugetlb_cgroup_css_offline() to work on folios Date: Fri, 10 Jan 2025 19:21:48 +0100 Message-ID: <20250110182149.746551-6-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: tiFZ2IZngdFCUBrBxSvo0rLZz5EJDN-VDBp0VcENDVg_1736533326 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0330040018 X-Stat-Signature: x8ddafau9gpnxuwf75o37nudwfuhuexa X-Rspam-User: X-HE-Tag: 1736533328-168710 X-HE-Meta: U2FsdGVkX1+TO+L+qBGuo0qLCwOLTna1cUtqyhhmha+TG7U03d/ycxgErTXkfnltFLPrMJ6bKyyC8GEpjnAVidCqI1ukeLazp7hTyTSFfpw1ontrD7zPxmIK0rQhFckYHmNdPA29QorlK8F4knzCTKJQSgvm0FzpjJOc6N0a/3GvIyg2OMGbbNwvJ8MXlOKqClKVNjRiiaLYJltMe4q01S3LNPyyiu0J1/Fp0rBcKbAlynpqhgG4z5E4JjHghALgyrCJNTYwqCrq2sXAZaO0KA0mltyVDXjHQjKRQ2t4gRc4p4PsMgdQbnasL3kEgYiRzSTbkFEXNV98MHcPizk6mwibAK2E8lSYHv5kxeDHlkO2SRhhSiGRN+pK8NNJot2AgLpwaNyvTuSkERN7xSpFYO4pTduzdBuRWoTPzC8TjdkxMGE6hrJOtBBMt5v6lwNaHpKN8DXMUPlNSTKfQ8lUGZx0Ramb3G6C1Ujcbvht9fa1wFLYY6wgYmme8/9Jt+HeOegy5NUEZXv5A/7bE4JThTkR4al9GzqIVcsNE/26dXTw59ChuHUdWja9oFUREDPeMQ/iVuhOblpsp3C7EmnHo1nNa5K6qQZm0bEIJFlWE7KCw8S2AlzcN2x1XwklBQiBwhUw4ZYHjdsJd3Or6vpG34TZDfhcudNk8tgtDV8/p6QenS+ZD6+oJxIsBTR/D4bn5dTD6BHEpTwJv00/E/yBryw851EeG5zT1ZBvTBLtCPU7nnjG5/flcjs3yrgRcI4ODvPJo3/JvFcI/Hl4V8mtiv0UJ2IoaNxgb2XBtB6v+42lIJy/eNv28cYVRdvwGaAxb2E9QAaBjdLu4gvNsxVdxY6SF58WIi+6/DIxqOKnY++e5ghgYF42RBLKvCGbWB1b5FeTWCj1I7L13KzWnHUBg3rFztZUcDqSb7bFI2vQQUg0hSPMVFyUHU9wQ8+R5RvRBrw2109hx8C8Rj5d+b7 AvpC8nYW VlQtHOjZU1Vb3ZZKxR+r31ftpYHwuWjQDyc5eFO90yZ7H9XO5mFgnBSJVHfRQTi5ny1pFG+xtaZLgzYSak2BYAQUFQQo5RKQQnuky6JG62fJrI00VJ1Ginrhtf2WWiZYbuQS9YD6beNPksqNN80NsUjyCV58EpvhiMGzTFsvq3LioeDMeTHRtimiNtcJIDLucGrVXvYrwzI8HbfjyYUyGhu4SpLxbrr/g+KMfceCILGOWx74p2jylIdPSqIRIuRZGIxgbhPlByh/RRmbxoJLq3P79AjyhuzYwdJnx/pwv4d3xTVU2AymdqRY/tCiKjhNF9TBN4XaEvRivLetkd9mJg08FPjrBondzunkdwMOIZyb0QJqOmC2JH7ptEPuCPsp5wX05ML8oK7JoAoyhvNbRfy7//vO7ao50bVCAr+tex4nvGQb54U4CMrFMzIaeICSQIfJVTmZ4orJtzwNYQ5v68FLw1NjP4u1RIfYyCdbxgO7okolnqcHUPTuRVnTRc/uDMgDEbnXgAzY/XvHEOv4ACnHHXA== 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: Let's convert hugetlb_cgroup_css_offline() and hugetlb_cgroup_move_parent() to work on folios. hugepage_activelist contains folios, not pages. While at it, rename page_hcg simply to hcg, removing most of the "page" terminology. Signed-off-by: David Hildenbrand Reviewed-by: Matthew Wilcox (Oracle) --- mm/hugetlb_cgroup.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 89a8ad45a533d..bb9578bd99f98 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -195,24 +195,23 @@ static void hugetlb_cgroup_css_free(struct cgroup_subsys_state *css) * cannot fail. */ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { unsigned int nr_pages; struct page_counter *counter; - struct hugetlb_cgroup *page_hcg; + struct hugetlb_cgroup *hcg; struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg); - struct folio *folio = page_folio(page); - page_hcg = hugetlb_cgroup_from_folio(folio); + hcg = hugetlb_cgroup_from_folio(folio); /* * We can have pages in active list without any cgroup * ie, hugepage with less than 3 pages. We can safely * ignore those pages. */ - if (!page_hcg || page_hcg != h_cg) + if (!hcg || hcg != h_cg) goto out; - nr_pages = compound_nr(page); + nr_pages = folio_nr_pages(folio); if (!parent) { parent = root_h_cgroup; /* root has no limit */ @@ -235,13 +234,13 @@ static void hugetlb_cgroup_css_offline(struct cgroup_subsys_state *css) { struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); struct hstate *h; - struct page *page; + struct folio *folio; do { for_each_hstate(h) { spin_lock_irq(&hugetlb_lock); - list_for_each_entry(page, &h->hugepage_activelist, lru) - hugetlb_cgroup_move_parent(hstate_index(h), h_cg, page); + list_for_each_entry(folio, &h->hugepage_activelist, lru) + hugetlb_cgroup_move_parent(hstate_index(h), h_cg, folio); spin_unlock_irq(&hugetlb_lock); } From patchwork Fri Jan 10 18:21:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13935198 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 23E45E7719C for ; Fri, 10 Jan 2025 18:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E14B6B00A5; Fri, 10 Jan 2025 13:22:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 968886B00B4; Fri, 10 Jan 2025 13:22:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 794956B00B5; Fri, 10 Jan 2025 13:22:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 52D516B00A5 for ; Fri, 10 Jan 2025 13:22:16 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C9D7844D82 for ; Fri, 10 Jan 2025 18:22:15 +0000 (UTC) X-FDA: 82992361830.10.2EA676B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 859304001E for ; Fri, 10 Jan 2025 18:22:13 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I9Ok0ugo; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736533333; a=rsa-sha256; cv=none; b=ZSssDZUE7rVAzPpG2w2LzruMA53/bFf+jDKCudm7dMKlyD9Q/uOtO70ArMByCMhpmG30SI OnmjmHJCsJTdKAuuM6V5ubHrU8g8uj1+thVsa3TlduvE56vIkimSq8Ma9FeM3QI1e0MNf3 Tw/e/R5qQBIU4SbEy4CN4HWb7F3UEWk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I9Ok0ugo; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736533333; 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=B64bx35uOXxQMEAOflKQlNSdLN9JGSwoqDOXWjVU1Rs=; b=lIfEA0H6pMXiVZcfujDMjULq/lADWMIsEiJqVLtj8dQoNqUjfonuMbHNeMSBkd00eW6ISw ccqabOzoHUKOQ06Y9WojZQMyzgICYvFsvU/kFg/XbsoNbMBU6jXuE0qpU0HttjAS9zv0cA 9+dralSRBib9Dr31oWqNQWN/N7KChGY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736533332; 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=B64bx35uOXxQMEAOflKQlNSdLN9JGSwoqDOXWjVU1Rs=; b=I9Ok0ugo1lw8AVoKf6SXnccYlAaDACwEEH8Y+V2nsdec+4BcuN27FutwrzdOqli7LkhWQ2 iP5t+Az9moDHv6OsfspPf+VhXGqExzYTkTN3cOoljR/EgcUeU1FRxnMSQ/0/WQ2m+vZ6Oi +HEq6VjTzhQmMDgTAdlOHgCVERC8PMM= 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-619-cJCOLC8yM1uRs4RONjVrQw-1; Fri, 10 Jan 2025 13:22:10 -0500 X-MC-Unique: cJCOLC8yM1uRs4RONjVrQw-1 X-Mimecast-MFC-AGG-ID: cJCOLC8yM1uRs4RONjVrQw Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-38a684a096eso990162f8f.2 for ; Fri, 10 Jan 2025 10:22:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533328; x=1737138128; 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=B64bx35uOXxQMEAOflKQlNSdLN9JGSwoqDOXWjVU1Rs=; b=QbWN+OdEj7Z1Hp+neOcGvHXNsUmYm5Pa2llq3yhl8HWIDVkp44Uq3lRpO+m1IGW5I/ alPRrb6GcT+109TofEgJZP8FDiSu5saXIWZRpfVghlSSyQfxUlFEXTXiZFqN9HpJkzbn zHitAgGcKViIn9lO2HusrXzlQnQc+4mMPAlpqf6EBTIqkQl+kTGTmHt1il7QqCedQROb 2CurzT5bKHLx8a7onDe2rarKBkJrKjrIi9jI0NeLENQFxMT8HHmBA71a9aZ6kRlWs/tr +16OGYiQkc5OWPno5dxGDeOdLBaj+0IWJyv3NuCRWpSy+ZDzdpTf7ufCK2z13pFNYZyp xYGg== X-Gm-Message-State: AOJu0YzuY4OT7rIvdHAoOzuL7A38zn64VdM3GIV1WivtRqKsY612BKdM g9qxzmf8JM5TwC0It3WruDdmvPA9U3bEwa96VZsyza1Y3gBncPbbeElKyLJFXWWVB4v/AmkwMpM Fk5oIGA8gsOxuzKBIupf1mKTsKkJAqyP9+NWnGKQrd2TCk7OalmrBZL1vQo8= X-Gm-Gg: ASbGncvfe9WAU6Jbtc4nziGMRZXKgH+6Kz5BDymj3jMODqf57YaKDsE1aeA1yFrclfZ R/rpVMuO4HLO1UzDyQEGwLm4VZxpaNTtA3BIX6u4PTbSquTtkSm7rSs7EeIW2tK8VU5fA0ZLNoX TYMBQerkybfPwPKWpzCHoyki5s7S2doI8bG6XZK6L7A3NBnsAh/BebrGbcYbT3g8Z7vnSlrRzRr JwcZZPrOYRtGbpzv+rQx5cFJ30vlAlN+zKSXrJO4kEZ7N0qGHGu3t+3qOdwA6cX08F1481+M+TV 6v+vP70YpvIbVp6u6MvXY/yHCgaXUnc/IU7uryKmQg== X-Received: by 2002:a5d:6da1:0:b0:385:dc45:ea06 with SMTP id ffacd0b85a97d-38a872deb27mr10509773f8f.13.1736533328625; Fri, 10 Jan 2025 10:22:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3vUT1h0m8haDgPT04bLRnZs0bSDTSjfCTisAMBTneAwCAWQyget6Tg/ZqSntMqTbfop892g== X-Received: by 2002:a5d:6da1:0:b0:385:dc45:ea06 with SMTP id ffacd0b85a97d-38a872deb27mr10509760f8f.13.1736533328325; Fri, 10 Jan 2025 10:22:08 -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-38a8e383654sm5232309f8f.30.2025.01.10.10.22.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 10:22:07 -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 6/6] mm/hugetlb: use folio->lru int demote_free_hugetlb_folios() Date: Fri, 10 Jan 2025 19:21:49 +0100 Message-ID: <20250110182149.746551-7-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: aJhu8WGNa-QvLtFy4lMX7UMDXluAckTZiIBqxaxPiUE_1736533329 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 859304001E X-Stat-Signature: o4tfzurtecciba3c3tyc1wiuck76rpaa X-Rspam-User: X-HE-Tag: 1736533333-445075 X-HE-Meta: U2FsdGVkX1+KSbUUBHrWbxfuaLa/d0Fy+b0fOtDb4GmIeZMvoR1CIb7BhDrFbxaDg0+WGvazXdkVYw+h8lmdCUFpl1iQzSP/FO8SDD0kw9JqbGQwESHi8ILfMZLmQM52udwlz0+HXsJB55vt97KAMgEchVlOLTUXxthcbCTGNLTaSBP5yCxTv1oTlps/MiOWMZLImiosAlRW4Iya/oXb7/dhNi0uE8ki+2qD5M74IinYMsMdf1MQv6JHm+P6a09aKL2pFcVPzgluM+pqbKRhlEOIgi1wivBUjcrz2u5TCOPR63FD72um+O6xZfdz4hBCU6ToZhEFaKdXMIZdf2Ggp4Ge5MkhM2ASzw7e+yEbNI9ow/RlQ3cg1WoFbpOe03qntHnP7qMXxtloD5jU28lun3ugyFaNL4tggOclNuHvXvmfCh3roDUCLI/o6simoKmSSJ79qXD/BSVcTuWRO7oFsGOnWEGJOhdZWW9ORiP+wWvVxrmb7Ipy36jNJjtht2gijKP3z5uGsyWfkwbBzC7TmkrA8TA0zs2KOIqxOBIKSkXHACUGheeZzepsIuMcok5KQ2M5HEHfIc5f3ZSHSq0B/ty77zHHE2n0QKyqkw9aSemO5/dMGa1Xx3iEhewo1eK6oavyyYdkmbzdItH52e5GORCse3aKh4wuDQEjxRB6Bmkf5C8xBisjSxffRwB4ZVla3oftsPpWtDlPJePAsZso/mJd4Hf8xXKl8/m1OFbcFjzIdpr+1Os3em1Io9uHSenOtZcTWEAbZyoZrdi2uwCfykNmbBb2o/c9JjbElvFH4IkkWVx/jcbVDpVkEW+rEZCWh63dAbxb4mCDHhURHRR6Xlwn+APgMK5te3bHtz4MlkaQcs/G9M5ncncqMoVyxzZjS/mAtTVY+TC3eNFbsGxNFKD+ctwiZ//T8WQIxrA4m9ltABYq3oU+2CUP/0KfRSml55/H1nrYz61vp46/fMt p0yjbpFN 0pxn/RqfxtxY0AEsyU4qNs4Mfy/8jCLiT3YIgqLhcpPpuwv9nX4Sl/RG9p4MnQNnJV4eLgdrKovnzZcqIWmAjfeqYQP+lw3xmXBNfWXPQE7TkLk7hQLzaPm7lWoTOPFQ7COdY+9qePImpJ9xwATKslGjIfg93er8EGY0YKcydCx4IN1RzvMMruNsy4S4aqUgZMqmf8M5YYjtKtv9LQzbyq/DjqWZ7cB088gAzmNuURIan4nnxP9pIAYbc6TIqYYD2+CcrT1gMB8Ez2YV4EYP3ptu1/75dgKNPkkfhAxwXo6GhB6UzQBU4vFGscIHgPsF/wq1OVo0H91egxqJ1NGgGGdWml6GmzeoQm2h5Bodd4DEgi5L7MbIiAR36xUOM7K54xJqLNZyleObK45czEXZx83O/jsi+P91XJPk3H+sLb/Vt+TIVi65NJ2YXpm9/9ktrt7NFi48eDiFf/UMU8kTi8b5u0rKhMlKRsIC0rPnEpCFDib/pLqxdwrEIKyVdMLuCzBQryZaHa6FsbsHUKrI0sgS+V9GgQ1EgHg49 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We are demoting hugetlb folios to smaller hugetlb folios; let's avoid messing with pages where avoidable. Signed-off-by: David Hildenbrand --- mm/hugetlb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 60617eecb99dd..e872eff124abb 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3822,13 +3822,15 @@ static long demote_free_hugetlb_folios(struct hstate *src, struct hstate *dst, for (i = 0; i < pages_per_huge_page(src); i += pages_per_huge_page(dst)) { struct page *page = folio_page(folio, i); + struct folio *new_folio; page->mapping = NULL; clear_compound_head(page); prep_compound_page(page, dst->order); + new_folio = page_folio(page); - init_new_hugetlb_folio(dst, page_folio(page)); - list_add(&page->lru, &dst_list); + init_new_hugetlb_folio(dst, new_folio); + list_add(&new_folio->lru, &dst_list); } }