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/O7AUz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4YEYqlX3V5LrfjY9etS2dXJ6auJd6p1/1QDgEDkJUQ0Psy/FRxXetoexXsTwsbKDBiBehZwBJViIUUX46/8r7I6wwbFBu12LLWR+ExVXYECyDIGqvlcHhC7ho1WweltYXqejL55Nep7KOczFmJnxD4Wb4KPLl13Ax7N0eo5/XodopB6QpSu7uRbKsvj9qdHlt66fF8s/bRevHWtz6hlEA5r8caCzgssKXxoVjJTxmb7z2x8qcTvgrzv7YYjvTBayC508yTMVLSG8qugcaBEPmfaJrLNNkzbl/DbvMJbhaxImlZGG2qEkbUjoS+s= 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: 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))