linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Matthew Wilcox <willy@infradead.org>, Yang Yang <yang.yang29@zte.com.cn>
Cc: akpm@linux-foundation.org, mhocko@suse.com,
	pavel.tatashin@microsoft.com, osalvador@suse.de,
	rppt@linux.vnet.ibm.com, iamjoonsoo.kim@lge.com,
	alexander.h.duyck@linux.intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn,
	wang.yi59@zte.com.cn
Subject: Re: [PATCH] mm: do not consider SWAP to calculate available when not necessary
Date: Mon, 26 Nov 2018 08:41:49 +0100	[thread overview]
Message-ID: <fe5e1615-00ac-2962-3db9-4c385e239d9d@suse.cz> (raw)
In-Reply-To: <20181126020115.GF3065@bombadil.infradead.org>

On 11/26/18 3:01 AM, Matthew Wilcox wrote:
> On Mon, Nov 26, 2018 at 07:58:23AM +0800, Yang Yang wrote:
>> When si_mem_available() calculates 'available', it takes SWAP
>> into account. But if CONFIG_SWAP is N or SWAP is off(some embedded system
>> would like to do that), there is no need to consider it.
> 
> I don't understand this patch.  The pagecache can be written back to
> storage if it is dirty, regardless of whether there is swap space.
> 
>> @@ -4724,9 +4726,13 @@ long si_mem_available(void)
>>  	 * Not all the page cache can be freed, otherwise the system will
>>  	 * start swapping. Assume at least half of the page cache, or the

I guess the first sentence in the comment above might be misleading by
using the word 'swapping', where 'thrashing' would be more accurate and
unambiguous.

So this is not related to the swap, but to the assumption that somebody
is accessing the pages in pagecache, and if too much would be freed,
most accesses would mean reading data from disk, i.e. thrashing.

>>  	 * low watermark worth of cache, needs to stay.
>> +	 * But if CONFIG_SWAP is N or SWAP is off, do not consider it.
>>  	 */
>>  	pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE];
>> -	pagecache -= min(pagecache / 2, wmark_low);
>> +#ifdef CONFIG_SWAP
>> +	if (i.totalswap > 0)
>> +		pagecache -= min(pagecache / 2, wmark_low);
>> +#endif
>>  	available += pagecache;
>>  
>>  	/*
>> -- 
>> 2.15.2
>>

      reply	other threads:[~2018-11-26  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 23:58 Yang Yang
2018-11-26  2:01 ` Matthew Wilcox
2018-11-26  7:41   ` Vlastimil Babka [this message]

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=fe5e1615-00ac-2962-3db9-4c385e239d9d@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=wang.yi59@zte.com.cn \
    --cc=willy@infradead.org \
    --cc=yang.yang29@zte.com.cn \
    --cc=zhong.weidong@zte.com.cn \
    /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