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]
Message-ID: <4F440154.7010403@openvz.org>
Date:	Wed, 22 Feb 2012 00:40:52 +0400
From:	Konstantin Khlebnikov <khlebnikov@...nvz.org>
To:	Hugh Dickins <hughd@...gle.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Ying Han <yinghan@...gle.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/10] mm/memcg: take care over pc->mem_cgroup

Hugh Dickins wrote:
> On Tue, 21 Feb 2012, Konstantin Khlebnikov wrote:
>>
>> But just one question: how appears uncharged pages in mem-cg lru lists?
>
> One way is swapin readahead pages, which cannot be charged to a memcg
> until they're "claimed"; but we do need them visible on lru, otherwise
> memory pressure couldn't reclaim them when necessary.

Ok, this is really reasonable.

>
> Another way is simply that uncharging has not historically removed the
> page from lru list if it's on.  I usually assume that's an optimization:
> why bother to get lru locks and take it off (and put it on the root lru?
> if we don't, we're assuming it's will be freed very shortly - I'm not
> sure that's always a good assumption), if freeing the page will usually
> do that for us (without having to change lrus).
>
> If I thought for longer, I might come up with other scenarios.
>
>> Maybe we can forbid this case and uncharge these pages right in
>> __page_cache_release() and release_pages() at final removing from LRU.
>> This is how my old mem-controller works. There pages in lru are always
>> charged.
>
> As things stand, that would mean lock_page_cgroup() has to disable irqs
> everywhere.  I'm not sure of the further ramifications of moving uncharge
> to __page_cache_release() and release_pages().  I don't think a change
> like that is out of the question, but it's certainly a bigger change
> than I'd like to consider in this series.

Ok. I have another big question: Why we remove pages from lru at last put_page()?

Logically we can remove them in truncate_inode_pages_range() for file
and in free_pages_and_swap_cache() or something at last unmap for anon.
Pages are unreachable after that, they never become alive again.
Reclaimer also cannot reclaim them in this state, so there no reasons for keeping them in lru.
Into those two functions pages come in large batches, so we can remove them more effectively,
currently they are likely to be removed right in this place, just because release_pages() drops
last references, but we can do this lru remove unconditionally.
Plus it never happens in irq context, so lru_lock can be converted to irq-unsafe in some distant future.

>
> Hugh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ