lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Jun 2021 22:23:36 +0800
From:   yong w <yongw.pur@...il.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     minchan@...nel.org, ngupta@...are.org, senozhatsky@...omium.org,
        axboe@...nel.dk, akpm@...ux-foundation.org,
        songmuchun@...edance.com, David Hildenbrand <david@...hat.com>,
        linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
        linux-mm@...ck.org, willy@...radead.org, linux-api@...r.kernel.org,
        lu.zhongjun@....com.cn, yang.yang29@....com.cn,
        zhang.wenya1@....com.cn, wang.yong12@....com.cn
Subject: Re: [RFC PATCH V3] zram:calculate available memory when zram is used

Greg KH <gregkh@...uxfoundation.org> 于2021年6月8日周二 下午5:29写道:

>
> On Mon, Jun 07, 2021 at 08:39:14AM -0700, yongw.pur@...il.com wrote:
> > From: wangyong <wang.yong12@....com.cn>
> >
> > 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]
>
> Why is this needed to be exported by userspace?  Who is going to use
> this information and why can't they just calculate it from the exported
> information already?

In embedded devices, it is necessary to assess how much memory is available.
If the memory allocation is based on available+swapfree, it may cause oom and
affect the normal use of the devices. And it is more accurate and safe
to calculate
the swap available memory through minimum compression ratio.

Although mm_stat interface provides compressed information,but it is not easy to
get the minimum compression ratio during swaping out. Kernel provides a common
interface, which makes it easier to use and judge the state of system memory

> What tool requires this new information and what is it going to be used
> for?

It can be used in embedded devices to evaluate the memory condition
and avoid causing oom; Also If we wants to know more accurate available
memory information when zram is used.

> And why add a block driver's information to a core proc file?  Shouldn't
> the information only be in the block driver's sysfs directory only?
>
> thanks,
>
> greg k-h

I thought it would be better to put it there.
In the first patch, MemAvailable returned with swap available memory, and
David recommended a separate interface.

thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ