From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Leonid Moiseichuk <leonid.moiseichuk@nokia.com>,
John Stultz <john.stultz@linaro.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linaro-kernel@lists.linaro.org
Subject: Re: [PATCH 1/3] vmevent: Should not grab mutex in the atomic context
Date: Mon, 9 Apr 2012 16:29:50 +0400 [thread overview]
Message-ID: <20120409122950.GA21833@lizard> (raw)
In-Reply-To: <1333960831.3943.4.camel@jaguar>
On Mon, Apr 09, 2012 at 11:40:31AM +0300, Pekka Enberg wrote:
> On Mon, 2012-04-09 at 03:38 +0400, Anton Vorontsov wrote:
> > vmevent grabs a mutex in the atomic context, and so this pops up:
> >
> > BUG: sleeping function called from invalid context at kernel/mutex.c:271
> > in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/0
[...]
> > This patch fixes the issue by removing the mutex and making the logic
> > lock-free.
> >
> > Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
>
> What guarantees that there's only one thread writing to struct
> vmevent_attr::value in vmevent_sample() now that the mutex is gone?
Well, it is called from the timer function, which has the same guaranties
as an interrupt handler: it can have only one execution thread (unlike
bare softirq handler), so we don't need to worry about racing w/
ourselves?
If you're concerned about several instances of timers accessing the
same vmevent_watch, I don't really see how it is possible, as we
allocate vmevent_watch together w/ the timer instance in vmevent_fd(),
so there is always one timer per vmevent_watch.
Thanks,
--
Anton Vorontsov
Email: cbouatmailru@gmail.com
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Leonid Moiseichuk <leonid.moiseichuk@nokia.com>,
John Stultz <john.stultz@linaro.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linaro-kernel@lists.linaro.org
Subject: Re: [PATCH 1/3] vmevent: Should not grab mutex in the atomic context
Date: Mon, 9 Apr 2012 16:29:50 +0400 [thread overview]
Message-ID: <20120409122950.GA21833@lizard> (raw)
In-Reply-To: <1333960831.3943.4.camel@jaguar>
On Mon, Apr 09, 2012 at 11:40:31AM +0300, Pekka Enberg wrote:
> On Mon, 2012-04-09 at 03:38 +0400, Anton Vorontsov wrote:
> > vmevent grabs a mutex in the atomic context, and so this pops up:
> >
> > BUG: sleeping function called from invalid context at kernel/mutex.c:271
> > in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/0
[...]
> > This patch fixes the issue by removing the mutex and making the logic
> > lock-free.
> >
> > Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
>
> What guarantees that there's only one thread writing to struct
> vmevent_attr::value in vmevent_sample() now that the mutex is gone?
Well, it is called from the timer function, which has the same guaranties
as an interrupt handler: it can have only one execution thread (unlike
bare softirq handler), so we don't need to worry about racing w/
ourselves?
If you're concerned about several instances of timers accessing the
same vmevent_watch, I don't really see how it is possible, as we
allocate vmevent_watch together w/ the timer instance in vmevent_fd(),
so there is always one timer per vmevent_watch.
Thanks,
--
Anton Vorontsov
Email: cbouatmailru@gmail.com
next prev parent reply other threads:[~2012-04-09 12:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-08 23:36 [PATCH 0/3] vmevent: Some fixes + a new event type Anton Vorontsov
2012-04-08 23:36 ` Anton Vorontsov
2012-04-08 23:38 ` [PATCH 1/3] vmevent: Should not grab mutex in the atomic context Anton Vorontsov
2012-04-08 23:38 ` Anton Vorontsov
2012-04-09 8:40 ` Pekka Enberg
2012-04-09 8:40 ` Pekka Enberg
2012-04-09 12:29 ` Anton Vorontsov [this message]
2012-04-09 12:29 ` Anton Vorontsov
2012-04-09 12:37 ` Pekka Enberg
2012-04-09 12:37 ` Pekka Enberg
2012-04-08 23:38 ` [PATCH 2/3] vmevent-test: No need for SDL library Anton Vorontsov
2012-04-08 23:38 ` Anton Vorontsov
2012-04-09 8:20 ` Pekka Enberg
2012-04-09 8:20 ` Pekka Enberg
2012-04-08 23:38 ` [PATCH 3/3] vmevent: Implement cross event type Anton Vorontsov
2012-04-08 23:38 ` Anton Vorontsov
2012-04-09 8:30 ` Pekka Enberg
2012-04-09 8:30 ` Pekka Enberg
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=20120409122950.GA21833@lizard \
--to=anton.vorontsov@linaro.org \
--cc=john.stultz@linaro.org \
--cc=leonid.moiseichuk@nokia.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.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 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.