From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4128C43603 for ; Tue, 17 Dec 2019 05:10:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 91B282072D for ; Tue, 17 Dec 2019 05:10:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="se7J/6kU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91B282072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1ih57n-0000Og-6o; Tue, 17 Dec 2019 00:10:23 -0500 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1ih57l-0000OR-PP for kernelnewbies@kernelnewbies.org; Tue, 17 Dec 2019 00:10:21 -0500 Received: by mail-io1-xd2e.google.com with SMTP id b10so9557226iof.11 for ; Mon, 16 Dec 2019 21:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=WPPem31zkI2VFx4WIU8hg+Zj81v7FJuJQ7A6PnuVMkQ=; b=se7J/6kUFZuaOAXHArjciP3uO3stHVUfkath1n29MCVowk1+Af3xcFYB3FJx5hiNEa e9tGLymJxM95oaPToCRD5/gUNGNqSyYtd4cZtg6LqmSUn1FtxZUTOVFCnRoWdJwvdkH7 ysGaCkMcwZU4ntGwXYyWwTnXw3oXBrvX1MUc/qob+zF4fgX7KqbUXuLPAgtvd2ghql3i XXIq1nmrcT+AsE4/vdyNC2y7lKj0AyX2GC571ZpQ9Y7huXt9MRcxeBNzcVSDIQ1RfC1f 8ot+6cbT6gpSa76nLM/ujHFYgUvNI6B/fvRkmzmBqb96cZ3Ambj8RwQMrxb5PlvjGVMG pvZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=WPPem31zkI2VFx4WIU8hg+Zj81v7FJuJQ7A6PnuVMkQ=; b=jcsr8ckx8uU94ZfOotMgQhp6nt1Mx8r0ALb26qWQ3AertczZBc/6syIoGjeixXs3Hc DfruJwL2s6PIY+tvc5Up3X7+5VQ3cp1tyShBrfC36NiZnIm1K0aV+E456oQ6tJ36U+n6 jgclhoCboZqyrAjhfcTsyK8Adx1XKCGAm6YcmCxePZdrsG2RY3QsjqB1HCTTtzD3X8ZQ TuXRJCzQmDmQNd9sRpJc77KhzC6tvcVRcgl68ftOsvXKfRju3iSkhGkv+jeNTZQa+TUo IIgBxA2/SbTmDJ8wsQ1B7ttlg+lc8bjS3inikhbgX/IfRdoofms24fAHqDUiudpaPAmB k5KQ== X-Gm-Message-State: APjAAAVBR2zAZi6XSFn5GRWvUMMJWHAG9Yo+Kpjc03TUrEmIu4vblJ6y XJvTqslADcjEinbRIcAcAAFL62HXsypt6HHtsTggIwNxHqg= X-Google-Smtp-Source: APXvYqym+zmdPQbfmdiejdrZet49VrweEV/5j25x/aqoAU87UpscO9/g1/nDUlgkMohDqAh1gtoS309BkSHW5HBaN6o= X-Received: by 2002:a5d:81c8:: with SMTP id t8mr2355428iol.204.1576559359631; Mon, 16 Dec 2019 21:09:19 -0800 (PST) MIME-Version: 1.0 From: Neel chakraborty Date: Tue, 17 Dec 2019 10:39:08 +0530 Message-ID: Subject: Free RAM in Linux . To: kernelnewbies@kernelnewbies.org 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="===============5985072931295187460==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============5985072931295187460== Content-Type: multipart/alternative; boundary="0000000000009928600599df5446" --0000000000009928600599df5446 Content-Type: text/plain; charset="UTF-8" I was studying the Linux Kernel Source , and came across this doubt . Does Linux use all of the physical memory (RAM) I have ? In both the outputs of /proc/meminfo and free -h , shows that 1.4 gigs is used and 1.6 gigs is cached , and the rest is "free" out of 32 Gigs . The available ram is the cached ram + reclaimable ram + free ram , right ? I went through the source code of /fs/proc/meminfo.c and it's polling ram usage from the sysinfo struct , so I browsed through /linux/include/uapi/Linux/sysinfo.h , over there freeram is available memory size . But again in meminfo.c , we are seeing MemFree as i.freeram ( here i is assigned to the structure of type sysinfo ) . so is free ram = available memory ? But then , I have free ram of 27 Gi , and available memory of 28 Gi , why is that ? And also , does the linux kernel use the amount of ram which is not used by applications as paging cache ? Say I have 4 gigs of ram , and Firefox is using 1 gig of it , the rest of RAM is used for disk/page caching or is it just unused and left there ? Thank you --0000000000009928600599df5446 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I was studying the Li= nux Kernel Source , and came across this doubt .

Does Linux use all of the physical memory (RAM) I have ? In both the outputs of /proc/meminfo and free -h , shows that 1.4 gigs is used and 1.6 gigs is cached , and the rest is "free" out of 32 Gigs . The availabl= e ram=20 is the cached ram + reclaimable ram + free ram , right ?

I went through the source code of /fs/proc/meminfo.c and it's polling ra= m usage from the sysinfo struct , so I browsed through=20 /linux/include/uapi/Linux/sysinfo.h , over there freeram is available=20 memory size .

But again in me= minfo.c , we are seeing MemFree as i.freeram ( here i is assigned to the st= ructure of type sysinfo ) .

s= o is free ram =3D available memory ? But then , I have free ram of 27 Gi , = and available memory of 28 Gi , why is that ?

And also , does the linux kernel use the amount of ram which is not used by applications as paging cache ? Say I have 4 gigs of ram , and Firefox=20 is using 1 gig of it , the rest of RAM is used for disk/page caching or is = it just unused and left there ?

Thank you

--0000000000009928600599df5446-- --===============5985072931295187460== 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 --===============5985072931295187460==--