From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A7DB1F30BB for ; Tue, 9 Jun 2026 11:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781005586; cv=none; b=GbjxM+SY+ySGICuyW8W/CPP5qGARcfyRw9lgfffbnxrxJbG0I7OlWi+iKPLxCg3l3/Rf5bWAZPmaPymW5z6+Sy0Cbs8GFv4Yj0uRo8VG4LrGhqeZnZnc28sVb7TLS0pxP6CCFTsEOTJibKuaCTv4Y1RbLs0DAC0sn79JUhvtnJk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781005586; c=relaxed/simple; bh=rtX2wJpQXoTq2SuZD6FrhJe1A/jIgxEo2FAt0/Ew41M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QBBR2CrxIruksQNUKKZVym0HC5QBBzntnuuej21rniqHFhxDh20TaXLpfPQ3K4Pal4jSIZympwI1k9H57pR7ZYEhBDErtNaos3PeKsMTujT/OvDv+6Py4RtjDR75WSYOwR3bYwQzL8tm99xeBSss2IRQTDjQf1OTX1cA/4YDKwI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MG7PIpyn; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MG7PIpyn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781005584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nhNHZLa+n24acJIFuPt+V/OC6yOiHReSpx19Be8ar1A=; b=MG7PIpynasNbT7Vjal7StMJcSaDay5xbKf+DDpn3CryyiP8aJIE7eRbr7x5zuzaNRV1qep tx9HbChCkLfNoC1+tQvRIPpdn6eEKlmVzrAkLSpA+JLgnTc6pmNFQ/qIvSxro3iAZ4SBqw bMIpUv0ia546YBOh7SH3F/FrNM4V1T8= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-IZ11byxvOoCpDbVnF2Y7dg-1; Tue, 09 Jun 2026 07:46:21 -0400 X-MC-Unique: IZ11byxvOoCpDbVnF2Y7dg-1 X-Mimecast-MFC-AGG-ID: IZ11byxvOoCpDbVnF2Y7dg_1781005578 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3947B195DE17; Tue, 9 Jun 2026 11:46:18 +0000 (UTC) Received: from p1.redhat.com (unknown [10.44.22.33]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4646C1955DC9; Tue, 9 Jun 2026 11:46:09 +0000 (UTC) From: Nico Pache To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Usama Arif , Yu Zhao Cc: aarcange@redhat.com, Nico Pache , David Hildenbrand , Andrew Morton , Xu Xin , Chengming Zhou , Lorenzo Stoakes , Zi Yan , Baolin Wang , "Liam R. Howlett" , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple Subject: [PATCH mm-unstable v1 3/3] mm/huge_memory.c: Skip zero-page remapping when underused THP shrinker is disabled Date: Tue, 9 Jun 2026 05:46:15 -0600 Message-ID: <20260609114619.144416-4-npache@redhat.com> In-Reply-To: <20260609114619.144416-1-npache@redhat.com> References: <20260609114619.144416-1-npache@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 The zero-page remapping in __folio_split() was added to support the underused THP shrinker. When the shrinker is disabled via shrink_underused, gate TTU_USE_SHARED_ZEROPAGE on split_underused_thp to avoid scanning subpages for zero content unnecessarily. Suggested-by: David Hildenbrand Signed-off-by: Nico Pache --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 94bd656eeaf8..37748d92f277 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4103,7 +4103,7 @@ static int __folio_split(struct folio *folio, unsigned int new_order, if (nr_shmem_dropped) shmem_uncharge(mapping->host, nr_shmem_dropped); - if (!ret && is_anon && !folio_is_device_private(folio)) + if (!ret && is_anon && !folio_is_device_private(folio) && split_underused_thp) ttu_flags = TTU_USE_SHARED_ZEROPAGE; remap_page(folio, 1 << old_order, ttu_flags); -- 2.54.0