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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32B70C53210 for ; Sun, 8 Jan 2023 09:50:29 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1pESJV-0004R6-2Y; Sun, 08 Jan 2023 04:50:01 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1pESJQ-0004He-0z for kernelnewbies@kernelnewbies.org; Sun, 08 Jan 2023 04:49:56 -0500 Received: by mail-lf1-x132.google.com with SMTP id bt23so8540618lfb.5 for ; Sun, 08 Jan 2023 01:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1Y1QN9wzum0XINkfUBK8E4hJITddjKS5TiKgWripcbw=; b=pbFmApcGouEE7lRWIB+1sYI+H+DSJzmO9h+66I0W+5qLPuBfMMP1B3cbSzxt9PfFCf fnLyThrpq0h3D7vwligOhinC1b6I0nfYNn54OdR1POC0wp5VDkN30je586EL5f8ysTK7 E4i04dnepg8kMVCFSpZDyAUhy8JHeBdIs6jynSDrBGS/gvN746EZXPj3FM83DMK8NG45 CAJZ66coIgQUfiuPQFDM1LOVBdBs2gsy5zvmcGNCBzdJxEQDKcQWtpvDtvM9gX1RYve/ JcJPPQ4xYkFYZXp7+nX0TLwHm6Wt/m5zxwYNa1HelymCS9x/TnWC8S0Z6vNM0TXwMHTA BiwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1Y1QN9wzum0XINkfUBK8E4hJITddjKS5TiKgWripcbw=; b=QCBMXPf31dPGtbM6Ibaqjqg1xXWcYWjmKk7rYWjMvVfMhM8hWMosUAR6RJbdIH1Aau +9hngy9gMRT+VRyIva7cCCAFG4BoNfuDsdCkUhzBXdbRd9bPfB88u8m9DhAsMvRuCeeE v9wE2p3uXrqku7JWs/SSQ0ej6KSVFntBSMzp2NHcSZXq8xGKCMMHDzYuTJflQxDooQMC Axdr3iGDeQnVvGU+5RlX1g0RVvrEgaK8u6bB4iWALYPtrnRWVgIBXjZrp8P2jYh6kI+5 DxNJ+pTNZj7By/9/qHA1/+4BulBEBDAPNpND5Wvo+nEg/0LKtYYRF0j3PNPuMMCAckKt aalw== X-Gm-Message-State: AFqh2kqvIXF1I8t2Bw0g9qXkM/pdB6Gh1EgshO3OqzXPACNbf6Q3jCHd shrySVGbZRYXfv1paSbtRNljQ3+4N+zL X-Google-Smtp-Source: AMrXdXsl38RewpTIcdBxGJm5Y+h4zRu3M0erCBiAUYE/o4VDmKBMKtJMqJ3R9EMHOcwVkPcTFJJlpA== X-Received: by 2002:a19:ee0a:0:b0:4b5:8d45:7f32 with SMTP id g10-20020a19ee0a000000b004b58d457f32mr15113688lfb.56.1673171394143; Sun, 08 Jan 2023 01:49:54 -0800 (PST) Received: from sqrt.uni.cx (0854358661.static.corbina.ru. [95.31.0.167]) by smtp.gmail.com with ESMTPSA id k7-20020ac257c7000000b004b57bbaef87sm982097lfo.224.2023.01.08.01.49.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 01:49:53 -0800 (PST) Date: Sun, 8 Jan 2023 12:49:52 +0300 From: Mikhail Krylov To: kernelnewbies@kernelnewbies.org Subject: Re: Determining the reason for reserved RAM Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============7293959178364118599==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============7293959178364118599== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jgzh+WFgb5YvHeeH" Content-Disposition: inline --jgzh+WFgb5YvHeeH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I think I (partly) found the answer myself. The biggest part that is in 0x35b4a000-0x36b55fff area is memory map. Its size corresponds really well with sizeof(struct page)*number of pages (it should be exactly 15M instead of 16). And looking on it with gdb I was able to see 40-byte patterns that closely resemble array of these structs. The only problem I had is that kernel's symbol mem_map doesn't point to this structure, it is set to 0, but I guess it's probably not used anymore. On Tue, Jan 03, 2023 at 09:51:08PM +0300, Mikhail Krylov wrote: > Hello, >=20 > I was doing some research figuring out what kernel reserves memory for, > and found myself in a sort of dead-end. >=20 > I found out that /proc/kpageflags bit 32 is set for reserved physical > pages in include/linux/kernel-page-flags.c, wrote a simple decoder of > that file, and on an old 32-bit x86 machine (it's the simplest there, > since it has less memory and fewest amount of memory holes) those are > reserved: >=20 > 0x00000000-0x0000ffff - I assume those addresses are used for interrupt > vectors and whatnot > 0x0009b000-0x000fffff - Video RAM/ROM for VGA/EGA/CGA and whatnot > 0x01c00000-0x01c1ffff - no idea, it also has KPF_UNCACHED flag as well > 0x1d000000-0x1dd73fff - Kernel code, rodata, rwdata, bss > 0x35b4a000-0x36b55fff - no idea. >=20 > I also found out that region #5 is getting bigger or smaller depending > on the machine's memory size. On this 1.5G machine it's a bit more than > 16M. On a 32G machine it's more than 500M size, feels a bit wasteful > IMO. So my question is, could you tell me where to look for what those > regions are and why those regions exist? I've checked /proc/iomem and > it doesn't say it is reserved or anything, just "System RAM". >=20 > Thanks in advance, Mikhail. --jgzh+WFgb5YvHeeH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEq9zNqT9shXHTn/gRzNfc0dbmrQAFAmO6kcAACgkQzNfc0dbm rQAzOwf+OUy/iXAlsJumyMePeFnOhTSBksb4caTE0LfUlTYjAQ4wgYjK2UEDuOAk 1ZUVOKP5YNECxkSX0lmmAkTcPpgmt7Yh0UkvENT+dQEe81mP0MchSMIjmKTNvN5E s2CmJlLZyFDPpohyE9UwRbtvyvncQOgeN9NKVViq9Ff6WnryQWHa0BYxg3hHl2Sg Zu80F6lLgE5g5+MJ2pbpag87Yk+y3fvGOCM7NSzOhRTcIQDOhWqPZgcGTt7sN7u5 2WDO1+cktQPibGWuIaaPuUfEBCmNH5ukaWK9vZb9t8uqJKzJujzteP3KBJEsrY+x oF+lq+NiIjEFUvs6TG677lQHud/hag== =7uZR -----END PGP SIGNATURE----- --jgzh+WFgb5YvHeeH-- --===============7293959178364118599== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============7293959178364118599==--