From patchwork Fri Jun 7 08:37:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13689481 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 A8F83C27C53 for ; Fri, 7 Jun 2024 08:37:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45E976B00A8; Fri, 7 Jun 2024 04:37:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40EE06B00A9; Fri, 7 Jun 2024 04:37:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D6B26B00AA; Fri, 7 Jun 2024 04:37:32 -0400 (EDT) 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 0D7EB6B00A8 for ; Fri, 7 Jun 2024 04:37:32 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 798994184F for ; Fri, 7 Jun 2024 08:37:31 +0000 (UTC) X-FDA: 82203438702.17.4FC92A0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id CAEF71A0007 for ; Fri, 7 Jun 2024 08:37:29 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Uex4DVjL; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@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=1717749449; 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=/fwBtdoh3359SXZDjchmPGzkh5xSmHZDLRHxcqN3RR4=; b=GJpoMv+vf1gtNOm/z+3NFp4cgmyypyCal5/hFdEYVjp60vqSH9oRuYACp3d28/Qi1pLHMZ l2G9KLZuAaQdNQ9ZraWdzfTQ69QVzCCrVQfAVelYKPtG62M8vQBdr8LaGsNd2E9vRYsetK wDAyBkeq8KJAZ9MOMBHBeR0ArfMfCCg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717749449; a=rsa-sha256; cv=none; b=22uIWZ/SG+r8PdsxNZacv1NpUnJ2ez5vk+cU+c7//cs2ZqRsL7MAUT1LBT+yN/21nbN7py 22hQNkN/WpjCLC7Z9tLKLtxQSzwgSc1KT0wEvhdt/AH+R9eKeQNTpBZucpf13/DboQdmd0 kO8QAhAWA228bTN8wIDqfle8YM83rMA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Uex4DVjL; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@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=1717749449; 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=/fwBtdoh3359SXZDjchmPGzkh5xSmHZDLRHxcqN3RR4=; b=Uex4DVjLckx6UQfA7iU0GDJsB1F9zWZLzHhlrkYEVm74DkZIVOBPcnetDTEzenCcX6nXSB kuKJ9/KW7MZTo8UgNvVw4zhaSXMYg5ItHic+4Im/HwNUljKeISAsBcs5ZiaKx2mCNMYWnc k6kXDY5RsyvfBmKZSiLz92leuaezP4E= 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-691-d4bJ3LKmP7WWgT8xzXdCtQ-1; Fri, 07 Jun 2024 04:37:20 -0400 X-MC-Unique: d4bJ3LKmP7WWgT8xzXdCtQ-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 60B4D193D899; Fri, 7 Jun 2024 08:37:19 +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 E46551956048; Fri, 7 Jun 2024 08:37:16 +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 1/2] mm/highmem: reimplement totalhigh_pages() by walking zones Date: Fri, 7 Jun 2024 10:37:10 +0200 Message-ID: <20240607083711.62833-2-david@redhat.com> In-Reply-To: <20240607083711.62833-1-david@redhat.com> References: <20240607083711.62833-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspam-User: X-Stat-Signature: 3jc6c3gxrx5n44aogcx5g48mwx78mqp7 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CAEF71A0007 X-HE-Tag: 1717749449-247038 X-HE-Meta: U2Fs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28rk0FxYbrJq08sJJo8cGL7AZBXdkTHT+XvwR1Cwj1Qr+8c+RimczZMdnOvau9kqH4YmA5NB4HRorkkNfoWUj9OGvVCtcoEdok/lrOYaEjwdb8LHTANd4OHi/wNEHnL+lqPRtU/Qa/Enm9YPSaUd71shBsIJgbl3U0+ciTzEn3NbYQDjdVGx8lLar9W4dlBLhBYWanUazsLfqvlCi/czvtoTTg9j6XqzQFuEc0XonDHZW4PVI+gy+eSmPgzYzns40n3CUg5sxKzbvwtGQ9Gijgs7vFKgJVdoL3H3OMEoVZsvE 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: Can we get rid of the highmem ifdef in adjust_managed_page_count()? Likely yes: we don't have that many totalhigh_pages() users, and they all don't seem to be very performance critical. So let's implement totalhigh_pages() like nr_free_highpages(), collecting information from all zones. This is now similar to what we do in si_meminfo_node() to collect the per-node highmem page count. In the common case (single node, 3-4 zones), we really shouldn't care. We could optimize a bit further (only walk ZONE_HIGHMEM and ZONE_MOVABLE if required), but there doesn't seem a real need for that. Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang Reviewed-by: Oscar Salvador --- include/linux/highmem-internal.h | 9 ++------- mm/highmem.c | 16 +++++++++++++--- mm/page_alloc.c | 4 ---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index a3028e400a9c6..65f865fbbac04 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -132,7 +132,7 @@ static inline void __kunmap_atomic(const void *addr) } unsigned int __nr_free_highpages(void); -extern atomic_long_t _totalhigh_pages; +unsigned long __totalhigh_pages(void); static inline unsigned int nr_free_highpages(void) { @@ -141,12 +141,7 @@ static inline unsigned int nr_free_highpages(void) static inline unsigned long totalhigh_pages(void) { - return (unsigned long)atomic_long_read(&_totalhigh_pages); -} - -static inline void totalhigh_pages_add(long count) -{ - atomic_long_add(count, &_totalhigh_pages); + return __totalhigh_pages(); } static inline bool is_kmap_addr(const void *x) diff --git a/mm/highmem.c b/mm/highmem.c index bd48ba445dd41..3c4e9f8c26dcd 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -111,9 +111,6 @@ static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color) } #endif -atomic_long_t _totalhigh_pages __read_mostly; -EXPORT_SYMBOL(_totalhigh_pages); - unsigned int __nr_free_highpages(void) { struct zone *zone; @@ -127,6 +124,19 @@ unsigned int __nr_free_highpages(void) return pages; } +unsigned long __totalhigh_pages(void) +{ + unsigned long pages = 0; + struct zone *zone; + + for_each_populated_zone(zone) { + if (is_highmem(zone)) + pages += zone_managed_pages(zone); + } + + return pages; +} + static int pkmap_count[LAST_PKMAP]; static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index fc98082a9cf9c..2224965ada468 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5794,10 +5794,6 @@ void adjust_managed_page_count(struct page *page, long count) { atomic_long_add(count, &page_zone(page)->managed_pages); totalram_pages_add(count); -#ifdef CONFIG_HIGHMEM - if (PageHighMem(page)) - totalhigh_pages_add(count); -#endif } EXPORT_SYMBOL(adjust_managed_page_count); From patchwork Fri Jun 7 08:37:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13689482 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 92334C27C53 for ; Fri, 7 Jun 2024 08:37:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 262886B00AA; Fri, 7 Jun 2024 04:37:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ED836B00AB; Fri, 7 Jun 2024 04:37:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03F576B00AC; Fri, 7 Jun 2024 04:37:34 -0400 (EDT) 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 D45076B00AA for ; Fri, 7 Jun 2024 04:37:34 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 878658038D for ; Fri, 7 Jun 2024 08:37:34 +0000 (UTC) X-FDA: 82203438828.04.7F5BB6E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id CB2A9C0007 for ; Fri, 7 Jun 2024 08:37:32 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cyjf3Uc1; spf=pass (imf10.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@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=1717749452; 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=pXWfwhzpgOX74lB6RIPXOSDING4fKwOkibJ9ziHUHsg=; b=d8ne9TqdcVN5VXCbs1OxUaQG1/fBYF1u0jOJXL0Hoas2wd8tMjz8bg/dtgQ8u/3r12PV0h fLMGLXdPKFMTH7HDblgRzf8IquUlmsu5HQ8y/VKEJyKgpmwLXyAn9iIE+BgvItKR9N1CKm M5zaVED4feE4M2ZC60PyBB+jS0h4vuM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cyjf3Uc1; spf=pass (imf10.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717749452; a=rsa-sha256; cv=none; b=nE4u25Acs0nlzRSWc6y+PX5UiLeIaEONeceQqNh/fOIEy5gXzacLb/LdFSI6T3XozkflJy FIv/782PoTQ+SnzoWVAFbgk4NU/1a9rP4p+k432+r9qeVupVM1GkuEXG4qLqbq/+1Bh3KA xcNSg5RQGv+B42Wa9lR8BwNpaPMXFh4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717749452; 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=pXWfwhzpgOX74lB6RIPXOSDING4fKwOkibJ9ziHUHsg=; b=Cyjf3Uc1FSfYifPiaukqsDI2cjvCE4tVHWrHLANTLxYbGpzH53kB8Uv+ozdmfps36fFoku xMSSrHI3RWK5AZhdsxBtrsahvU0kJStNGTOvuHdAx76fkM/yfVKVtz/yG3SaVGgmc0Wl7n UhjrNtDoHGS09/iYLrHNNlf2czMH8+g= 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-43-r8zPj0gAO9GFTjIA0KVXaw-1; Fri, 07 Jun 2024 04:37:23 -0400 X-MC-Unique: r8zPj0gAO9GFTjIA0KVXaw-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 04444196DFC1; Fri, 7 Jun 2024 08:37:22 +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 AC7F21956048; Fri, 7 Jun 2024 08:37:19 +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 2/2] mm/highmem: make nr_free_highpages() return "unsigned long" Date: Fri, 7 Jun 2024 10:37:11 +0200 Message-ID: <20240607083711.62833-3-david@redhat.com> In-Reply-To: <20240607083711.62833-1-david@redhat.com> References: <20240607083711.62833-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Signature: bi41auy3ymjgdf1yqqd39zukcsozw7ag X-Rspamd-Queue-Id: CB2A9C0007 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1717749452-431331 X-HE-Meta: U2FsdGVkX1/O7AUzMJnONkT8NO6rdKLv6EjWz3iwXH0ffkyhuGgn6zssDIq5ylRETwXTOrv6OCdIyp01luJ83PNmys0tJ6Px+gusMB0VLRPGhXKa0R6v7rmloGa2rv5WUo36wN0fvaTS3xkoZVkb9MxPLXSR0K29HKonzBjIcL1JKzSgti5Tkv6YNmH93023OJcI8bIGLdm+JsDw1YxNjtrr074Wl0iF5F+4Wc0mJM2pAUx6N9NHw9WiCFqBaAgBbF705dJRi1vkchs4V2TyakC/vgeyK/hOJrwzdJ/HEhboLu1qLk+XpE3ZNBWYJ2gExhYTEFCs8pTR26dg0KzbkIsOSxxp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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: It looks rather weird that totalhigh_pages() returns an "unsigned long" but nr_free_highpages() returns an "unsigned int". Let's return an "unsigned long" from nr_free_highpages() to be consistent. While at it, use a plain "0" instead of a "0UL" in the !CONFIG_HIGHMEM totalhigh_pages() implementation, to make these look alike as well. Signed-off-by: David Hildenbrand Reviewed-by: Oscar Salvador Reviewed-by: Wei Yang --- include/linux/highmem-internal.h | 8 ++++---- include/linux/highmem.h | 2 +- mm/highmem.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index 65f865fbbac04..dd100e849f5e0 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -131,10 +131,10 @@ static inline void __kunmap_atomic(const void *addr) preempt_enable(); } -unsigned int __nr_free_highpages(void); +unsigned long __nr_free_highpages(void); unsigned long __totalhigh_pages(void); -static inline unsigned int nr_free_highpages(void) +static inline unsigned long nr_free_highpages(void) { return __nr_free_highpages(); } @@ -234,8 +234,8 @@ static inline void __kunmap_atomic(const void *addr) preempt_enable(); } -static inline unsigned int nr_free_highpages(void) { return 0; } -static inline unsigned long totalhigh_pages(void) { return 0UL; } +static inline unsigned long nr_free_highpages(void) { return 0; } +static inline unsigned long totalhigh_pages(void) { return 0; } static inline bool is_kmap_addr(const void *x) { diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 6b0d6f3c8580c..930a591b9b616 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -179,7 +179,7 @@ static inline void *kmap_local_folio(struct folio *folio, size_t offset); static inline void *kmap_atomic(struct page *page); /* Highmem related interfaces for management code */ -static inline unsigned int nr_free_highpages(void); +static inline unsigned long nr_free_highpages(void); static inline unsigned long totalhigh_pages(void); #ifndef ARCH_HAS_FLUSH_ANON_PAGE diff --git a/mm/highmem.c b/mm/highmem.c index 3c4e9f8c26dcd..1ece1e69031e7 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -111,10 +111,10 @@ static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color) } #endif -unsigned int __nr_free_highpages(void) +unsigned long __nr_free_highpages(void) { + unsigned long pages = 0; struct zone *zone; - unsigned int pages = 0; for_each_populated_zone(zone) { if (is_highmem(zone))