* [PATCH] increment nr_tasks in io_context when CLONE_IO is set
@ 2008-04-15 3:50 Nikanth Karthikesan
2008-04-15 7:24 ` Jens Axboe
[not found] ` <4804A6CF.BANGALORE.BLR.100.174746A.1.15A79.1@1:7.BANGALORE.BLR.100.0.1.0.1@16>
0 siblings, 2 replies; 3+ messages in thread
From: Nikanth Karthikesan @ 2008-04-15 3:50 UTC (permalink / raw
To: Jens Axboe; +Cc: Linux Kernel Mailing List
Increment the nr_tasks associated with the io_context when CLONE_IO flag
is set.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
--
diff --git a/kernel/fork.c b/kernel/fork.c
index dd249c3..01e843b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -812,6 +812,7 @@ static int copy_io(unsigned long clone_f
tsk->io_context = ioc_task_link(ioc);
if (unlikely(!tsk->io_context))
return -ENOMEM;
+ atomic_inc(&tsk->io_context->nr_tasks);
} else if (ioprio_valid(ioc->ioprio)) {
tsk->io_context = alloc_io_context(GFP_KERNEL, -1);
if (unlikely(!tsk->io_context))
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] increment nr_tasks in io_context when CLONE_IO is set
2008-04-15 3:50 [PATCH] increment nr_tasks in io_context when CLONE_IO is set Nikanth Karthikesan
@ 2008-04-15 7:24 ` Jens Axboe
[not found] ` <4804A6CF.BANGALORE.BLR.100.174746A.1.15A79.1@1:7.BANGALORE.BLR.100.0.1.0.1@16>
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2008-04-15 7:24 UTC (permalink / raw
To: Nikanth Karthikesan; +Cc: Linux Kernel Mailing List
On Tue, Apr 15 2008, Nikanth Karthikesan wrote:
> Increment the nr_tasks associated with the io_context when CLONE_IO flag
> is set.
>
> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
>
> --
> diff --git a/kernel/fork.c b/kernel/fork.c
> index dd249c3..01e843b 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -812,6 +812,7 @@ static int copy_io(unsigned long clone_f
> tsk->io_context = ioc_task_link(ioc);
> if (unlikely(!tsk->io_context))
> return -ENOMEM;
> + atomic_inc(&tsk->io_context->nr_tasks);
> } else if (ioprio_valid(ioc->ioprio)) {
> tsk->io_context = alloc_io_context(GFP_KERNEL, -1);
> if (unlikely(!tsk->io_context))
Fix is correct, however it would be more appropriate in ioc_task_link()
instead.
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index cac4b36..2b7a118 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -91,8 +91,10 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
* if ref count is zero, don't allow sharing (ioc is going away, it's
* a race).
*/
- if (ioc && atomic_inc_not_zero(&ioc->refcount))
+ if (ioc && atomic_inc_not_zero(&ioc->refcount)) {
+ atomic_inc(&ioc->nr_tasks);
return ioc;
+ }
return NULL;
}
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] increment nr_tasks in io_context when CLONE_IO is set
[not found] ` <4804A6CF.BANGALORE.BLR.100.174746A.1.15A79.1@1:7.BANGALORE.BLR.100.0.1.0.1@16>
@ 2008-04-16 3:35 ` Nikanth Karthikesan
0 siblings, 0 replies; 3+ messages in thread
From: Nikanth Karthikesan @ 2008-04-16 3:35 UTC (permalink / raw
To: Jens Axboe; +Cc: Linux Kernel Mailing List
On Tue, 2008-04-15 at 09:24 +0200, Jens Axboe wrote:
> On Tue, Apr 15 2008, Nikanth Karthikesan wrote:
> > Increment the nr_tasks associated with the io_context when CLONE_IO flag
> > is set.
> >
> > Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
> >
> > --
> > diff --git a/kernel/fork.c b/kernel/fork.c
> > index dd249c3..01e843b 100644
> > --- a/kernel/fork.c
> > +++ b/kernel/fork.c
> > @@ -812,6 +812,7 @@ static int copy_io(unsigned long clone_f
> > tsk->io_context = ioc_task_link(ioc);
> > if (unlikely(!tsk->io_context))
> > return -ENOMEM;
> > + atomic_inc(&tsk->io_context->nr_tasks);
> > } else if (ioprio_valid(ioc->ioprio)) {
> > tsk->io_context = alloc_io_context(GFP_KERNEL, -1);
> > if (unlikely(!tsk->io_context))
>
> Fix is correct, however it would be more appropriate in ioc_task_link()
> instead.
Yes. Thanks.
>
> diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
> index cac4b36..2b7a118 100644
> --- a/include/linux/iocontext.h
> +++ b/include/linux/iocontext.h
> @@ -91,8 +91,10 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
> * if ref count is zero, don't allow sharing (ioc is going away, it's
> * a race).
> */
> - if (ioc && atomic_inc_not_zero(&ioc->refcount))
> + if (ioc && atomic_inc_not_zero(&ioc->refcount)) {
> + atomic_inc(&ioc->nr_tasks);
> return ioc;
> + }
>
> return NULL;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-16 3:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 3:50 [PATCH] increment nr_tasks in io_context when CLONE_IO is set Nikanth Karthikesan
2008-04-15 7:24 ` Jens Axboe
[not found] ` <4804A6CF.BANGALORE.BLR.100.174746A.1.15A79.1@1:7.BANGALORE.BLR.100.0.1.0.1@16>
2008-04-16 3:35 ` Nikanth Karthikesan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).