mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mandeep Baines <msb@google.com>
To: "Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH 2/2] add a counter for writers spinning on a rwlock
Date: Mon, 26 Jan 2009 09:36:04 -0800	[thread overview]
Message-ID: <1fe6c7900901260936g63ea73a4naf1b90190352d057@mail.gmail.com> (raw)
In-Reply-To: <c62985530901260804o4022e0c0t5acba3f7c32c48ac@mail.gmail.com>

Hi Frédéric,

Unfortunately, this can't be done for hung_task. It writes to the
task_struct here:

static void check_hung_task(struct task_struct *t, unsigned long now,
                            unsigned long timeout)
{
        unsigned long switch_count = t->nvcsw + t->nivcsw;

        if (t->flags & PF_FROZEN)
                return;

        if (switch_count != t->last_switch_count || !t->last_switch_timestamp) {
                t->last_switch_count = switch_count;
                t->last_switch_timestamp = now;
                return;
        }

It is able to get away with using only a read_lock because no one else
reads or writes to these fields.

Regards,
Mandeep

On Mon, Jan 26, 2009 at 8:04 AM, Frédéric Weisbecker <fweisbec@gmail.com> wrote:
> 2009/1/26 Peter Zijlstra <peterz@infradead.org>:
>> On Mon, 2009-01-26 at 16:25 +0100, Frédéric Weisbecker wrote:
>>> 2009/1/26 Peter Zijlstra <peterz@infradead.org>:
>>> > On Sun, 2009-01-25 at 12:50 -0800, Frederic Weisbecker wrote:
>>> >> This patch adds a counter for writers that enter a rwlock slow path.
>>> >> For example it can be useful for slow background tasks which perform some jobs
>>> >> on the tasklist, such as the hung_task detector (kernel/hung_task.c).
>>> >>
>>> >> It adds a inc/dec pair on the slow path and 4 bytes for each rwlocks, so the overhead
>>> >> is not null.
>>> >>
>>> >> Only x86 is supported for now, writers_spinning_lock() will return 0 on other archs (which
>>> >> is perhaps not a good idea).
>>> >>
>>> >> Comments?
>>> >
>>> > _why_ ?
>>>
>>> The hung task detector runs a periodic loop through the task_list, and
>>> currently it doesn't run
>>> over an arbitrary threshold of tasks to not hold the task_list lock
>>> for too long.
>>>
>>> So we thought about a way to detect if there are some writers waiting
>>> for the lock, anf if so, release
>>> the lock, schedule and retry.
>>
>> Ah, if it can do that, then it can also use RCU, no? Only users who
>> really have to hold off new tasks need the read-task_lock. The rest can
>> use RCU.
>
>
> Really?
> That sounds a good news. Mandeep, what do you think?
>

  reply	other threads:[~2009-01-26 17:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-25 20:50 Frederic Weisbecker
2009-01-26 13:32 ` Ingo Molnar
2009-01-26 13:48 ` Peter Zijlstra
2009-01-26 15:25   ` Frédéric Weisbecker
2009-01-26 15:37     ` Peter Zijlstra
2009-01-26 16:04       ` Frédéric Weisbecker
2009-01-26 17:36         ` Mandeep Baines [this message]
2009-01-26 17:41           ` Peter Zijlstra
2009-01-27  0:30             ` [PATCH v4] softlockup: remove hung_task_check_count Mandeep Singh Baines
2009-01-27  9:27               ` Frederic Weisbecker
2009-01-27 13:26               ` Ingo Molnar
2009-01-27 18:48                 ` Mandeep Singh Baines
2009-01-28  8:25                   ` Peter Zijlstra
2009-01-29  1:42                     ` Mandeep Singh Baines
2009-01-30 20:41                       ` Mandeep Singh Baines
2009-01-30 20:46                       ` [PATCH 1/2] softlockup: convert read_lock in hung_task to rcu_read_lock Mandeep Singh Baines
2009-01-30 20:49                       ` [PATCH 2/2] softlockup: check all tasks in hung_task Mandeep Singh Baines
2009-01-31 19:22                         ` Peter Zijlstra
2009-02-03  0:05                           ` [PATCH 2/2 v2] " Mandeep Singh Baines
2009-02-03 12:23                             ` Ingo Molnar
2009-02-03 20:56                               ` [PATCH 2/2 v3] " Mandeep Singh Baines
2009-02-04 19:43                                 ` Ingo Molnar
2009-02-05  4:35                                   ` [PATCH 2/2 v4] " Mandeep Singh Baines
2009-02-05 14:34                                     ` Ingo Molnar
2009-02-05 17:48                                       ` Andrew Morton
2009-02-05 18:07                                         ` Ingo Molnar
2009-02-05 18:30                                           ` Andrew Morton
2009-02-05 18:58                                             ` Ingo Molnar
2009-02-05 18:40                                         ` Mandeep Singh Baines
2009-02-05 17:56                                       ` [PATCH] softlockup: convert read_lock in hung_task to rcu_read_lock Mandeep Singh Baines
2009-02-05 18:13                                         ` Ingo Molnar

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=1fe6c7900901260936g63ea73a4naf1b90190352d057@mail.gmail.com \
    --to=msb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®