]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/mem_detect: add get_mem_detect_online_total()
authorVasily Gorbik <gor@linux.ibm.com>
Sun, 29 Jan 2023 23:57:12 +0000 (00:57 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 6 Feb 2023 10:13:54 +0000 (11:13 +0100)
Add a function to get online memory in total. It is supposed to be used
in the decompressor as well as during early kernel startup.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/mem_detect.h

index 058ac2647eb7e93c09fdd5ef7833bbacfdba3ec8..08798ddf51430955acae5854961f3ce4b65e9d64 100644 (file)
@@ -66,6 +66,17 @@ static inline int __get_mem_detect_block(u32 n, unsigned long *start,
             i < mem_detect.count;                                      \
             i++, __get_mem_detect_block(i, p_start, p_end))
 
+static inline unsigned long get_mem_detect_online_total(void)
+{
+       unsigned long start, end, total = 0;
+       int i;
+
+       for_each_mem_detect_block(i, &start, &end)
+               total += end - start;
+
+       return total;
+}
+
 static inline void get_mem_detect_reserved(unsigned long *start,
                                           unsigned long *size)
 {