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: <20140605141841.GA23796@redhat.com>
Date:	Thu, 5 Jun 2014 16:18:41 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Richard Weinberger <richard@....at>
Cc:	hannes@...xchg.org, mhocko@...e.cz, bsingharora@...il.com,
	kamezawa.hiroyu@...fujitsu.com, akpm@...ux-foundation.org,
	vdavydov@...allels.com, tj@...nel.org, handai.szj@...bao.com,
	rientjes@...gle.com, rusty@...tcorp.com.au,
	kirill.shutemov@...ux.intel.com, linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC][PATCH] oom: Be less verbose if the oom_control event fd
	has listeners

On 06/05, Richard Weinberger wrote:
>
> +int mem_cgroup_has_listeners(struct mem_cgroup *memcg)
> +{
> +	int ret = 0;
> +
> +	if (!memcg)
> +		goto out;
> +
> +	spin_lock(&memcg_oom_lock);
> +	ret = !list_empty(&memcg->oom_notify);
> +	spin_unlock(&memcg_oom_lock);
> +
> +out:
> +	return ret;
> +}

Do we really need memcg_oom_lock to check list_empty() ? With or without
this lock we can race with list_add/del anyway, and I guess we do not care.

And perhaps the caller should check memcg != NULL. but this is subjective,
I won't argue.

Oleg.

--
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