All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Richard Weinberger <richard@nod.at>
Cc: hannes@cmpxchg.org, mhocko@suse.cz, bsingharora@gmail.com,
	kamezawa.hiroyu@jp.fujitsu.com, akpm@linux-foundation.org,
	vdavydov@parallels.com, tj@kernel.org, handai.szj@taobao.com,
	rientjes@google.com, rusty@rustcorp.com.au,
	kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC][PATCH] oom: Be less verbose if the oom_control event fd has listeners
Date: Thu, 5 Jun 2014 16:18:41 +0200	[thread overview]
Message-ID: <20140605141841.GA23796@redhat.com> (raw)
In-Reply-To: <1401976841-3899-2-git-send-email-richard@nod.at>

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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Richard Weinberger <richard@nod.at>
Cc: hannes@cmpxchg.org, mhocko@suse.cz, bsingharora@gmail.com,
	kamezawa.hiroyu@jp.fujitsu.com, akpm@linux-foundation.org,
	vdavydov@parallels.com, tj@kernel.org, handai.szj@taobao.com,
	rientjes@google.com, rusty@rustcorp.com.au,
	kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC][PATCH] oom: Be less verbose if the oom_control event fd has listeners
Date: Thu, 5 Jun 2014 16:18:41 +0200	[thread overview]
Message-ID: <20140605141841.GA23796@redhat.com> (raw)
In-Reply-To: <1401976841-3899-2-git-send-email-richard@nod.at>

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.


  reply	other threads:[~2014-06-05 14:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 14:00 oom: Be less verbose Richard Weinberger
2014-06-05 14:00 ` Richard Weinberger
2014-06-05 14:00 ` [RFC][PATCH] oom: Be less verbose if the oom_control event fd has listeners Richard Weinberger
2014-06-05 14:00   ` Richard Weinberger
2014-06-05 14:18   ` Oleg Nesterov [this message]
2014-06-05 14:18     ` Oleg Nesterov
     [not found]     ` <20140605141841.GA23796-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-06-05 15:46       ` Richard Weinberger
2014-06-05 15:46         ` Richard Weinberger
2014-06-05 15:46         ` Richard Weinberger
2014-06-05 16:00         ` Oleg Nesterov
2014-06-05 16:00           ` Oleg Nesterov
     [not found]           ` <20140605160029.GA28812-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-06-05 16:10             ` Richard Weinberger
2014-06-05 16:10               ` Richard Weinberger
2014-06-05 16:10               ` Richard Weinberger
2014-06-05 15:00   ` Michal Hocko
2014-06-05 15:00     ` Michal Hocko
2014-06-05 15:55     ` Richard Weinberger
2014-06-05 15:55       ` Richard Weinberger
2014-06-05 16:18       ` Michal Hocko
2014-06-05 16:18         ` Michal Hocko
     [not found]         ` <20140605161807.GD15939-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2014-06-05 21:58           ` Richard Weinberger
2014-06-05 21:58             ` Richard Weinberger
2014-06-05 21:58             ` Richard Weinberger
2014-06-05 21:01     ` David Rientjes
2014-06-05 21:01       ` David Rientjes
2014-06-06  9:10       ` Michal Hocko
2014-06-06  9:10         ` Michal Hocko

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=20140605141841.GA23796@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=handai.szj@taobao.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=richard@nod.at \
    --cc=rientjes@google.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    --cc=vdavydov@parallels.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.