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: <CALWz4ix_rVpgzDme06f2U44EaqWcZKCEb0ueByh1-dSmbaO1jA@mail.gmail.com>
Date:	Mon, 30 Apr 2012 10:02:54 -0700
From:	Ying Han <yinghan@...gle.com>
To:	Hiroyuki Kamezawa <kamezawa.hiroyuki@...il.com>
Cc:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
	Michal Hocko <mhocko@...e.cz>,
	Johannes Weiner <hannes@...xchg.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Glauber Costa <glommer@...allels.com>,
	Tejun Heo <tj@...nel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC][PATCH 9/9 v2] memcg: never return error at pre_destroy()

On Fri, Apr 27, 2012 at 5:25 PM, Hiroyuki Kamezawa
<kamezawa.hiroyuki@...il.com> wrote:
> On Sat, Apr 28, 2012 at 6:28 AM, Ying Han <yinghan@...gle.com> wrote:
>> On Thu, Apr 26, 2012 at 11:06 PM, KAMEZAWA Hiroyuki
>> <kamezawa.hiroyu@...fujitsu.com> wrote:
>>> When force_empty() called by ->pre_destroy(), no memory reclaim happens
>>> and it doesn't take very long time which requires signal_pending() check.
>>> And if we return -EINTR from pre_destroy(), cgroup.c show warning.
>>>
>>> This patch removes signal check in force_empty(). By this, ->pre_destroy()
>>> returns success always.
>>>
>>> Note: check for 'cgroup is empty' remains for force_empty interface.
>>>
>>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
>>> ---
>>>  mm/hugetlb.c    |   10 +---------
>>>  mm/memcontrol.c |   14 +++++---------
>>>  2 files changed, 6 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>>> index 4dd6b39..770f1642 100644
>>> --- a/mm/hugetlb.c
>>> +++ b/mm/hugetlb.c
>>> @@ -1922,20 +1922,12 @@ int hugetlb_force_memcg_empty(struct cgroup *cgroup)
>>>        int ret = 0, idx = 0;
>>>
>>>        do {
>>> +               /* see memcontrol.c::mem_cgroup_force_empty() */
>>>                if (cgroup_task_count(cgroup)
>>>                        || !list_empty(&cgroup->children)) {
>>>                        ret = -EBUSY;
>>>                        goto out;
>>>                }
>>> -               /*
>>> -                * If the task doing the cgroup_rmdir got a signal
>>> -                * we don't really need to loop till the hugetlb resource
>>> -                * usage become zero.
>>> -                */
>>> -               if (signal_pending(current)) {
>>> -                       ret = -EINTR;
>>> -                       goto out;
>>> -               }
>>>                for_each_hstate(h) {
>>>                        spin_lock(&hugetlb_lock);
>>>                        list_for_each_entry(page, &h->hugepage_activelist, lru) {
>>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>>> index 2715223..ee350c5 100644
>>> --- a/mm/memcontrol.c
>>> +++ b/mm/memcontrol.c
>>> @@ -3852,8 +3852,6 @@ static int mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
>>>                pc = lookup_page_cgroup(page);
>>>
>>>                ret = mem_cgroup_move_parent(page, pc, memcg, GFP_KERNEL);
>>> -               if (ret == -ENOMEM || ret == -EINTR)
>>> -                       break;
>>>
>>>                if (ret == -EBUSY || ret == -EINVAL) {
>>>                        /* found lock contention or "pc" is obsolete. */
>>> @@ -3863,7 +3861,7 @@ static int mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
>>>                        busy = NULL;
>>>        }
>>>
>>> -       if (!ret && !list_empty(list))
>>> +       if (!loop)
>>
>> This looks a bit strange to me... why we make the change ?
>>
> Ah, I should this move to an independet patch.
> Because we don't have -ENOMEM path to exit loop, the return value of
> this function
> is
>  0 (if loop !=0 this means lru is empty under the lru lock )
>  -EBUSY (if loop== 0)

>
> I'll move this part out as an independent clean up patch

Thanks ~

--Ying

> thanks,
> -kame
--
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