All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Huntsman <bryanh@codeaurora.org>
To: Colin Cross <ccross@android.com>
Cc: Paul Menage <menage@google.com>, Li Zefan <lizf@cn.fujitsu.com>,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, mbohan@codeaurora.org
Subject: Re: [PATCH] cgroup: Remove call to synchronize_rcu in cgroup_attach_task
Date: Fri, 21 Jan 2011 17:17:24 -0800	[thread overview]
Message-ID: <4D3A3024.9040402@codeaurora.org> (raw)
In-Reply-To: <1290563018-2804-1-git-send-email-ccross@android.com>

On 11/23/2010 05:43 PM, Colin Cross wrote:
> synchronize_rcu can be very expensive, averaging 100 ms in
> some cases.  In cgroup_attach_task, it is used to prevent
> a task->cgroups pointer dereferenced in an RCU read side
> critical section from being invalidated by delaying the call
> to put_css_set until after an RCU grace period.
> 
> To avoid the call to synchronize_rcu, make the put_css_set
> call rcu-safe by moving the deletion of the css_set links
> into rcu-protected free_css_set_rcu.
> 
> The calls to check_for_release in free_css_set_rcu now occur
> in softirq context, so convert all uses of the
> release_list_lock spinlock to irq safe versions.
> 
> The decrement of the cgroup refcount is no longer
> synchronous with the call to put_css_set, which can result
> in the cgroup refcount staying positive after the last call
> to cgroup_attach_task returns.  To allow the cgroup to be
> deleted with cgroup_rmdir synchronously after
> cgroup_attach_task, introduce a second refcount,
> rmdir_count, that is decremented synchronously in
> put_css_set.  If cgroup_rmdir is called on a cgroup for
> hich rmdir_count is zero but count is nonzero, reuse the
> rmdir waitqueue to block the rmdir until the rcu callback
> is called.
> 
> Signed-off-by: Colin Cross <ccross@android.com>
> ---
> 
> This patch is similar to what you described.  The main differences are
> that I used a new atomic to handle the rmdir case, and I converted
> check_for_release to be callable in softirq context rather than schedule
> work in free_css_set_rcu.  Your css_set scanning in rmdir sounds better,
> I'll take another look at that.  Is there any problem with disabling irqs
> with spin_lock_irqsave in check_for_release?
> 
>  include/linux/cgroup.h |    6 ++
>  kernel/cgroup.c        |  124 ++++++++++++++++++++++++++++--------------------
>  2 files changed, 78 insertions(+), 52 deletions(-)
> 

Colin, what became of this patch?  I see this in your Tegra tree for
Android.

http://android.git.kernel.org/?p=kernel/tegra.git;a=commit;h=05946a1e0fdb011ac0e6638ee60b181c584f127b

I looked in linux-next but didn't see it there.  This resolves a
performance issue on MSM SMP so I'm curious if this is going upstream.
 Thanks.

- Bryan


-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2011-01-22  1:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-21  2:00 [PATCH] cgroup: Remove RCU from task->cgroups Colin Cross
2010-11-21 23:02 ` Colin Cross
     [not found]   ` <AANLkTikx6d0_VFtZ4zWQucRCf=vFt7N2M6=0jpnKasEE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-22  4:06     ` [PATCH] cgroup: Convert synchronize_rcu to call_rcu in cgroup_attach_task Colin Cross
2010-11-22  4:06   ` Colin Cross
2010-11-23  8:14     ` Li Zefan
     [not found]       ` <4CEB77E0.10202-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2010-11-23  8:58         ` Colin Cross
2010-11-23  8:58       ` Colin Cross
     [not found]         ` <AANLkTimjpW6NZ6fEiVi0VzjkpQGVob4=VHsohXUiDQkJ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-23 20:22           ` Colin Cross
2010-11-23 20:22         ` Colin Cross
     [not found]     ` <1290398767-15230-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2010-11-23  8:14       ` Li Zefan
2010-11-24  1:24       ` Paul Menage
2010-11-24  1:24     ` Paul Menage
     [not found]       ` <AANLkTi=4-OgPUugnUBaqSU3oC=3wxTjAsOB_Ais3Or+i-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-24  1:43         ` [PATCH] cgroup: Remove call to synchronize_rcu " Colin Cross
2010-11-24  1:43           ` Colin Cross
2010-11-24  2:29           ` Colin Cross
2011-01-22  1:17           ` Bryan Huntsman [this message]
2011-01-22  2:04             ` Colin Cross
     [not found]             ` <4D3A3024.9040402-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-01-22  2:04               ` Colin Cross
     [not found]           ` <1290563018-2804-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2010-11-24  2:29             ` Colin Cross
2011-01-22  1:17             ` Bryan Huntsman
2011-01-28  1:17             ` Bryan Huntsman
2011-01-28  1:17           ` Bryan Huntsman
2010-11-24  2:06         ` [PATCH] cgroup: Convert synchronize_rcu to call_rcu " Li Zefan
2010-11-24  2:06       ` Li Zefan
2010-11-24  2:10         ` Colin Cross
     [not found]           ` <AANLkTi=6nwDCdzDz7E2EaAw2pf3KUVjmKMRqGfz5zVhP-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-24  5:37             ` [PATCH 1/2] cgroup: Set CGRP_RELEASABLE when adding to a cgroup Colin Cross
2010-11-24  5:37             ` [PATCH 2/2] cgroup: Remove call to synchronize_rcu in cgroup_attach_task Colin Cross
2010-11-24  5:37           ` [PATCH 1/2] cgroup: Set CGRP_RELEASABLE when adding to a cgroup Colin Cross
2010-11-24 23:54             ` Paul Menage
     [not found]               ` <AANLkTimFqJ+qPidS_81DKd7ExSxDG7GNi0gjcUEEq_7j-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-25  0:11                 ` Colin Cross
2010-11-25  0:11                   ` Colin Cross
2010-11-25  0:18                   ` Colin Cross
2010-11-25  0:21                   ` Paul Menage
2010-12-03  3:07                     ` Colin Cross
2010-12-17  0:54                       ` Paul Menage
     [not found]                         ` <AANLkTinZarXbEyb1xfJWjG4gN2qhTVTXTdso4Cym5M9T-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-17  1:12                           ` Colin Cross
2010-12-17  1:12                         ` Colin Cross
     [not found]                       ` <AANLkTim67fLN+PYz-P0TM0QRmvQKP80tyXSNKNSZhFZ2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-17  0:54                         ` Paul Menage
     [not found]                     ` <AANLkTimJA52-GTM=AzS+tkOugrsi6Keh0_j87vK1BkGv-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-03  3:07                       ` Colin Cross
     [not found]                   ` <AANLkTimwvP2Ey1gJ6AbbFNtDKjGZt4cwqL=08nGBa_PT-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-25  0:18                     ` Colin Cross
2010-11-25  0:21                     ` Paul Menage
     [not found]             ` <1290577024-12347-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2010-11-24 23:54               ` Paul Menage
2011-01-28  1:17               ` Bryan Huntsman
2011-01-28  1:17             ` Bryan Huntsman
     [not found]               ` <4D42192C.9000701-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-01-28  1:30                 ` Paul Menage
2011-01-28  1:30               ` Paul Menage
2011-01-28  1:48                 ` Michael Bohan
     [not found]                 ` <AANLkTin7B51maXHRH+FNmZ14bmWmEp9P2=2QTNqgq_Fi-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-28  1:48                   ` Michael Bohan
2010-11-24  5:37           ` [PATCH 2/2] cgroup: Remove call to synchronize_rcu in cgroup_attach_task Colin Cross
     [not found]             ` <1290577024-12347-2-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-01-28  1:17               ` Bryan Huntsman
2011-01-28  1:17             ` Bryan Huntsman
     [not found]         ` <4CEC7329.7070909-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2010-11-24  2:10           ` [PATCH] cgroup: Convert synchronize_rcu to call_rcu " Colin Cross
2010-11-24 18:58           ` Paul Menage
2010-11-24 18:58         ` Paul Menage
     [not found] ` <1290304824-22722-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2010-11-21 23:02   ` [PATCH] cgroup: Remove RCU from task->cgroups Colin Cross

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=4D3A3024.9040402@codeaurora.org \
    --to=bryanh@codeaurora.org \
    --cc=ccross@android.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mbohan@codeaurora.org \
    --cc=menage@google.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.