From patchwork Tue Jul 30 12:45:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13747380 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 0CDDDC3DA7E for ; Tue, 30 Jul 2024 12:54:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6219E6B008A; Tue, 30 Jul 2024 08:54:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D2586B008C; Tue, 30 Jul 2024 08:54:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 361CA6B0092; Tue, 30 Jul 2024 08:54:15 -0400 (EDT) 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 1ADA26B008A for ; Tue, 30 Jul 2024 08:54:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BB17E8026E for ; Tue, 30 Jul 2024 12:54:14 +0000 (UTC) X-FDA: 82396412028.28.7450334 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf12.hostedemail.com (Postfix) with ESMTP id DF99A40019 for ; Tue, 30 Jul 2024 12:54:12 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Qblb0GSb; spf=pass (imf12.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722344010; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xejBMxasF4z7vTbtt633OZCxjB3/TpD8KsbFAqhPXuY=; b=FgYuz7D6eNEo/rE++0W9TYTlvSrBP5aMKgGgmqeDP7tShQIRE0A7YX55XYi5yiw6pXwTKE jdegyU+teDLB084l5gxBe8E1dr3IMhPjKIlgaKOYt/OwM6cMkXbeX74OADQ/gdjfWzSNed Fy0m6rpaYo5E4kIWCgoRssyhSGYZvz0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Qblb0GSb; spf=pass (imf12.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722344010; a=rsa-sha256; cv=none; b=5LCVFvGhOoc8G9V96YNDC+TKC8pnzx4Ff7BW4wRwfR3EORmDp6eMoJp0GUpN0dknokmTkM oSJum/xaH2So0ThSgAdqx/X88CpQTmxrR0AGoSV5nCmUR1l4ryaHuFaIXqMDKlx8H8aDPB 6O2km6ZYBKzW2btRHNOj+kvOqjcEYjM= Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6b7a4668f1fso26060506d6.3 for ; Tue, 30 Jul 2024 05:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722344052; x=1722948852; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xejBMxasF4z7vTbtt633OZCxjB3/TpD8KsbFAqhPXuY=; b=Qblb0GSb8VTJ0z2pgM6C4UOqThFcP1/M5A7XX1yol4HHQbhcYLKY4oELyqM9csP9Pm 6KmZikxS8BY4DQjb+dGwCte69kUNQQAmaMqWVz95KOIsxf1YXbDCJxmR6pNlccJ4UMS0 Zj6Ncj7lsiRAbdWGONJSaIjzjCHs4sBUOctEb7eaMMs7UjtMq2WS5IR0154khablwTh/ xDcJpKR44AdiLnyhUzdlCG2fKcSqem6HIsZJCSotdRK342adu2aEiNZGPoLxPR89rbNm 02j+fil1f+kioO2wbBzRCTQDYLQYZUH3TCKffBLViA00Be9aQfj7xXMe9yCXs/xIK3fQ Azqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722344052; x=1722948852; 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=xejBMxasF4z7vTbtt633OZCxjB3/TpD8KsbFAqhPXuY=; b=p5XgMg3CIaa5uzInqrky541tvo3VBLzxvMWRGq2PBycMS+cPq66mIMWFIQZNwQg+/v u4ly/9JxqAfGP7Hy90UQcee/eDPYVZN2gKxZDiNe+7U6E2wcMDDMD9z6gRFRnITjB8ep cgyip5ZpPYg6T+DgmnQvcBtDscAZgoYTJ421gJC4T0SAGC1Ho8ISSRUpBUXWR8rnnM9J JPIyAMFGPgVtoiIXF/z8o9zFX41WQs42BiD/fkXA3OUge/LR6MkDJGhEXoDwei2km/el aegspr/VNBtRcOnIAuiSf/ulFLGhK18KziAP3pArRVm5lQQwoQBxOZ8h8InSl6310yH7 qq2w== X-Forwarded-Encrypted: i=1; AJvYcCWYOYAlUeVOHo/QiG5iHZ7P4x23yzMenkyTkP5eak0VD1OxZbXgVldwV7eJLzmtfNnhidOEOgbDiw6nK4KutDKmdg8= X-Gm-Message-State: AOJu0YzNjT6EpuQ3do2lciwM79FtXg9keglAv43s40Plnexwy59+KWHo BVhZC/8OuObnsVliFr6Ylnq6RMt20dUWa59CzKHOF2Ydvsy/NwoG X-Google-Smtp-Source: AGHT+IH1TaNMaT1owhjXGb3Te5E+aSoMQp8eh+KW6WOTF5nBI+raPcLbOMS88vx6Ilwbsv6KRamZCA== X-Received: by 2002:a05:6214:4019:b0:6b9:299b:94ba with SMTP id 6a1803df08f44-6bb55ad89a7mr115074966d6.46.1722344051931; Tue, 30 Jul 2024 05:54:11 -0700 (PDT) Received: from localhost (fwdproxy-ash-112.fbsv.net. [2a03:2880:20ff:70::face:b00c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44fe8123516sm50426311cf.1.2024.07.30.05.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 05:54:11 -0700 (PDT) From: Usama Arif To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev, roman.gushchin@linux.dev, yuzhao@google.com, david@redhat.com, baohua@kernel.org, ryan.roberts@arm.com, rppt@kernel.org, willy@infradead.org, cerasuolodomenico@gmail.com, corbet@lwn.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@meta.com, Usama Arif Subject: [PATCH 2/6] Revert "mm: remove free_unref_page_list()" Date: Tue, 30 Jul 2024 13:45:59 +0100 Message-ID: <20240730125346.1580150-3-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730125346.1580150-1-usamaarif642@gmail.com> References: <20240730125346.1580150-1-usamaarif642@gmail.com> MIME-Version: 1.0 X-Stat-Signature: k6okmpk8xfuxmsaf144jjdwronycmfqh X-Rspam-User: X-Rspamd-Queue-Id: DF99A40019 X-Rspamd-Server: rspam02 X-HE-Tag: 1722344052-681709 X-HE-Meta: U2FsdGVkX1/0fdYWDkDl+YWN6lWk7Wgn0vwCZ3JoVQpUT95V+YXKIsmm/UcqX2oK6eClssDzxU792nDWdEboOYA1vtaZtisVPC+MH72BSJhp842ooe5SVuYAazCS4o14l8xUsB8Yq077YfPucEn0N7PfbSdZt7zTz1t93BM/e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WMqanjeKiA+kYHYKNW1rEnkmPkPv5WdfosrWvDZlDqE2IPEPi0YSBvJxvSIluDmuyaYBl0rMFO/gQhi6s7tdMEFzspI7rFYMx4n2hsD4olXJT/RzYVfajDitUvGsbfjGglokuT2GBLh 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: free_unref_page_list will be needed in a later patch for an optimization to free zapped tail pages when splitting isolated thp. Signed-off-by: Usama Arif --- mm/internal.h | 1 + mm/page_alloc.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/mm/internal.h b/mm/internal.h index 7a3bcc6d95e7..259afe44dc88 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -680,6 +680,7 @@ extern int user_min_free_kbytes; void free_unref_page(struct page *page, unsigned int order); void free_unref_folios(struct folio_batch *fbatch); +void free_unref_page_list(struct list_head *list); extern void zone_pcp_reset(struct zone *zone); extern void zone_pcp_disable(struct zone *zone); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index aae00ba3b3bd..38832e6b1e6c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2774,6 +2774,24 @@ void free_unref_folios(struct folio_batch *folios) folio_batch_reinit(folios); } +void free_unref_page_list(struct list_head *list) +{ + struct folio_batch fbatch; + + folio_batch_init(&fbatch); + while (!list_empty(list)) { + struct folio *folio = list_first_entry(list, struct folio, lru); + + list_del(&folio->lru); + if (folio_batch_add(&fbatch, folio) > 0) + continue; + free_unref_folios(&fbatch); + } + + if (fbatch.nr) + free_unref_folios(&fbatch); +} + /* * split_page takes a non-compound higher-order page, and splits it into * n (1<