public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: yongw.pur@gmail.com
Cc: minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org,
	axboe@kernel.dk, akpm@linux-foundation.org,
	songmuchun@bytedance.com, david@redhat.com,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-mm@kvack.org, willy@infradead.org,
	linux-api@vger.kernel.org
Subject: Re: [RFC PATCH V2] zram:calculate available memory when zram is used
Date: Sat, 5 Jun 2021 19:07:15 +0200	[thread overview]
Message-ID: <YLuvQwkZkl9UCoJw@kroah.com> (raw)
In-Reply-To: <1622910240-4621-1-git-send-email-yongw.pur@gmail.com>

On Sat, Jun 05, 2021 at 09:24:00AM -0700, yongw.pur@gmail.com wrote:
> From: wangyong <yongw.pur@gmail.com>
> 
> When zram is used, available+Swap free memory is obviously
> bigger than we actually can use, because zram can compress
> memory by compression algorithm and zram compressed data
> will occupy memory too.
> 
> So, we can count the compression ratio of zram in the kernel.
> The space will be saved by zram and other swap device are
> calculated as follows:
> zram[swapfree - swapfree * compress ratio] + swapdev[swapfree]
> We can evaluate the available memory of the whole system as:
> MemAvailable+zram[swapfree - swapfree * compress ratio]+swapdev[swapfree]
> 
> Add an entry to the /proc/meminfo file, returns swap will save space.
> Which name is more appropriate is still under consideration.
> There are several alternative names: SwapAvailable, SwapSaved,
> SwapCompressible
> 
> Signed-off-by: wangyong <yongw.pur@gmail.com>
> ---
>  drivers/block/zram/zcomp.h    |  1 +
>  drivers/block/zram/zram_drv.c | 19 +++++++++
>  drivers/block/zram/zram_drv.h |  1 +
>  fs/proc/meminfo.c             |  1 +
>  include/linux/swap.h          | 10 +++++
>  mm/swapfile.c                 | 95 +++++++++++++++++++++++++++++++++++++++++++
>  mm/vmscan.c                   |  1 +
>  7 files changed, 128 insertions(+)

You are adding a new sysfs file with no new Documentation/ABI entry.
Also are you sure you are allowed to add a new proc file entry without
breaking existing tools?

thanks,

greg k-h

  reply	other threads:[~2021-06-05 17:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 16:24 [RFC PATCH V2] zram:calculate available memory when zram is used yongw.pur
2021-06-05 17:07 ` Greg KH [this message]
2021-06-06 10:45   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLuvQwkZkl9UCoJw@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=david@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=senozhatsky@chromium.org \
    --cc=songmuchun@bytedance.com \
    --cc=willy@infradead.org \
    --cc=yongw.pur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox