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); } }