Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp892906lqt; Fri, 7 Jun 2024 01:37:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWOH8Z9avpzMScjruuXQOjAUzJ4Z9EQ0k6v1l8mzNhy8pVaEDMUmkdGouP7+RajW5WTjEIXtz1GF0QsRCmmOYiwb5LjPCq5Hs/IPhuyxQ== X-Google-Smtp-Source: AGHT+IGgBt/DmUmWypS+VavG22WNe1pA5vRRF6oOW4qT5H4yiZ15nIQsIw2jTwJyr4rwnhVhwY68 X-Received: by 2002:a17:90a:5312:b0:2bd:f4cb:bd87 with SMTP id 98e67ed59e1d1-2c2bcad5b27mr1885249a91.14.1717749449101; Fri, 07 Jun 2024 01:37:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717749449; cv=pass; d=google.com; s=arc-20160816; b=lJYQ3ARZkLtemBpBqH7LOHQ2IE9an75g99CWsB36YKuks/1GHJw15Hie3vZk89JjsE Nv04GxW9xkrmtO3F6tkntBtdKg8ADfuvJTON33X3mXIwJQysA/hr/6lGGMrljoKY8LfW JVYfYX0m4f42VMp3qByxC6KtOoDT5W3twmXDr7IyZerVswr2m+VaEuRLU/fNkMe/9jmU Zr3J6L2trSWhCvquENbIf0N20iOB3QFWONhBEw5GCDJFr++6YvvK9krmpQ6eu9cFdSzi 2ERQqA955frm8Jhu1OG/gwoneePJQ+ydGL8hekWpz6LFQ9Wj79x6y3MoaL+aaCM0Tk2W k1Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=M8ah2Ds86Vnl2swvOWW1huIAKIJrzy4AOAoWffTTPH0=; fh=UwdS/+IIuHmZ16I8Mnen8XQ2v0AwT/YObZ5sk3RpG/I=; b=Df9sEH5W4NOuMXeiAbJDmwo6QnxnfptN0hewK5879cK0+tIJWP/CIOyPKgzVGedOwR 3TJ9uPwTG4jHYiAb6mlaB2Qjr1w37lxOpT9DMp2G2+G2kf/Kg1J7rnV3zZ9/X370VLoh 2cyp49NRVcNSwkhBCHd2SIeIPgqh/dm9KzTCwNjcyOmxwcA7FrQPuYS9a9vMZ2hcaDUQ c0+Oa5QOoW6oozYJf0L8stG/VRoXfkCYvoAgQPgwGghMCLtQLAcr5mV6IzgTOld2purF JxgXirMimi8Eq/eghB6ljeN23zDr8umFew0uhUh4666dzP9voUdu/ZRqxdTvISzWPcmU pyHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eS2FJ2Iq; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-205611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806d27dbsi4468586a91.131.2024.06.07.01.37.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 01:37:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eS2FJ2Iq; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-205611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 493572833B3 for ; Fri, 7 Jun 2024 08:37:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEBF415B128; Fri, 7 Jun 2024 08:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eS2FJ2Iq" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 4983715443A for ; Fri, 7 Jun 2024 08:37:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749443; cv=none; b=ES5KyRdh8aiJ1WMdv4zPqlNiTpCP92ehItrBcfdVTQFNH/M7KCq7cnsdrJCDriiLOshUW/G+bLWLxS4XL8xVRYAmqCiIb++NRzljOR/AreGxhMg5/ALanl8TxJ8s2+8c5YKi1yDpP5U5vSVrqg1lgzdc+b9k9Oo/gRkhSgVgtH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749443; c=relaxed/simple; bh=g2rcMWyp8GlzCipqNrvSLZZa077Ie31QTsgAwJF3cZc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KmUAPZrIMQe/dvWXwIJg3WQzKduinpdNYKG7F5Pzmf3e6KzCjWBJJMJkxrhazBY1d+ROR0fdoZVsTlU4idVLOr6ETWPejo5huiWzxIehaooQezHsmQfacNeZe4FD3evqnEmiVh1AHO4PspXM8wdnRf5MOHgZ3zB2ROIO0H/JN28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=eS2FJ2Iq; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717749441; 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; bh=M8ah2Ds86Vnl2swvOWW1huIAKIJrzy4AOAoWffTTPH0=; b=eS2FJ2IqPlEm4YzQupjdA768wDome0eCCuNw4YnUEgVLD2oKC2l87XjW+JX7T6utKHDyPE 8RnCKCgrQuZGTg7uDhrKAMxhCunP/7pFooZo0MMfodyfPJptnWgHl+Reexjkzf0lDsH0Q8 V973JHleg11HYWFTOIyDB49xovcFe1U= 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-202-wAHZVWDZNJy7X6xJAQaCKA-1; Fri, 07 Jun 2024 04:37:17 -0400 X-MC-Unique: wAHZVWDZNJy7X6xJAQaCKA-1 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 7D12D1935DE8; Fri, 7 Jun 2024 08:37:16 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.194.94]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A84A21956048; Fri, 7 Jun 2024 08:37:13 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Wei Yang Subject: [PATCH v1 0/2] mm/highmem: don't track highmem pages manually Date: Fri, 7 Jun 2024 10:37:09 +0200 Message-ID: <20240607083711.62833-1-david@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 Let's remove highmem special-casing from adjust_managed_page_count(), to result in less confusion why memblock manually adjusts totalram_pages, and __free_pages_core() only adjusts the zone's managed pages -- what about the highmem pages that adjust_managed_page_count() updates? Now, we only maintain totalram_pages and a zone's managed pages independent of highmem support. We can derive the number of highmem pages simply by looking at the relevant zone's managed pages. I don't think there is any particular fast path that needs a maximum-efficient totalhigh_pages() implementation. Note that highmem memory is currently initialized using free_highmem_page()->free_reserved_page(), not __free_pages_core(). In the future we might want to also use __free_pages_core() to initialize highmem memory, to make that less special, and consider moving totalram_pages updates into __free_pages_core() [1], so we can just use adjust_managed_page_count() in there as well. Booting a simple kernel in QEMU reveals no highmem accounting change: Before: Memory: 3095448K/3145208K available (14802K kernel code, 2073K rwdata, 5000K rodata, 740K init, 556K bss, 49760K reserved, 0K cma-reserved, 2244488K highmem) After: Memory: 3095276K/3145208K available (14802K kernel code, 2073K rwdata, 5000K rodata, 740K init, 556K bss, 49932K reserved, 0K cma-reserved, 2244488K highmem) [1] https://lkml.kernel.org/r/20240601133402.2675-1-richard.weiyang@gmail.com Cc: Andrew Morton Cc: Wei Yang David Hildenbrand (2): mm/highmem: reimplement totalhigh_pages() by walking zones mm/highmem: make nr_free_highpages() return "unsigned long" include/linux/highmem-internal.h | 17 ++++++----------- include/linux/highmem.h | 2 +- mm/highmem.c | 20 +++++++++++++++----- mm/page_alloc.c | 4 ---- 4 files changed, 22 insertions(+), 21 deletions(-) base-commit: 19b8422c5bd56fb5e7085995801c6543a98bda1f -- 2.45.1