All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: ntl@pobox.com
Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org,
	Oren Laadan <orenl@cs.columbia.edu>,
	linux-aio@kvack.org
Subject: Re: [PATCH 02/10] Introduce mm_has_pending_aio() helper
Date: Tue, 01 Mar 2011 10:40:18 -0500	[thread overview]
Message-ID: <x494o7mrgrh.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <1298936432-29607-3-git-send-email-ntl@pobox.com> (ntl@pobox.com's message of "Mon, 28 Feb 2011 17:40:24 -0600")


[added linux-aio@kvack.org to the cc list]

ntl@pobox.com writes:

> From: Nathan Lynch <ntl@pobox.com>
>
> Support for AIO is on the to-do list, but until that is implemented,
> checkpoint will have to fail if a mm_struct has outstanding AIO
> contexts.  Add a mm_has_pending_aio() helper function for this
> purpose.

Just because a process has an io context, doesn't mean that the process
has active outstanding requests.  So, is this really what you wanted to
test?

Cheers,
Jeff

> Based on original "check_for_outstanding_aio" patch by Serge Hallyn.
>
> Signed-off-by: Serge E. Hallyn <serge@hallyn.com>
> [ntl: changed name and return type to clearly express semantics]
> [ntl: added kerneldoc]
> Signed-off-by: Nathan Lynch <ntl@pobox.com>
> ---
>  fs/aio.c            |   27 +++++++++++++++++++++++++++
>  include/linux/aio.h |    2 ++
>  2 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 8c8f6c5..1acbc99 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1847,3 +1847,30 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
>  	asmlinkage_protect(5, ret, ctx_id, min_nr, nr, events, timeout);
>  	return ret;
>  }
> +
> +/**
> + * mm_has_pending_aio() - check for outstanding AIO operations
> + * @mm:		The mm_struct to check.
> + *
> + * Returns true if there is at least one non-dead kioctx on
> + * @mm->ioctx_list.  Note that the result of this function is
> + * unreliable unless the caller has ensured that new requests cannot
> + * be submitted against @mm (e.g. through freezing the associated
> + * tasks).
> + */
> +bool mm_has_pending_aio(struct mm_struct *mm)
> +{
> +	struct kioctx *ctx;
> +	struct hlist_node *n;
> +	bool has_aio = false;
> +
> +	rcu_read_lock();
> +	hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) {
> +		if (!ctx->dead) {
> +			has_aio = true;
> +			break;
> +		}
> +	}
> +	rcu_read_unlock();
> +	return has_aio;
> +}
> diff --git a/include/linux/aio.h b/include/linux/aio.h
> index 7a8db41..39d9936 100644
> --- a/include/linux/aio.h
> +++ b/include/linux/aio.h
> @@ -214,6 +214,7 @@ struct mm_struct;
>  extern void exit_aio(struct mm_struct *mm);
>  extern long do_io_submit(aio_context_t ctx_id, long nr,
>  			 struct iocb __user *__user *iocbpp, bool compat);
> +extern bool mm_has_pending_aio(struct mm_struct *mm);
>  #else
>  static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
>  static inline int aio_put_req(struct kiocb *iocb) { return 0; }
> @@ -224,6 +225,7 @@ static inline void exit_aio(struct mm_struct *mm) { }
>  static inline long do_io_submit(aio_context_t ctx_id, long nr,
>  				struct iocb __user * __user *iocbpp,
>  				bool compat) { return 0; }
> +static inline bool mm_has_pending_aio(struct mm_struct *mm) { return false; }
>  #endif /* CONFIG_AIO */
>  
>  static inline struct kiocb *list_kiocb(struct list_head *h)

  reply	other threads:[~2011-03-01 15:41 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 23:40 [RFC 00/10] container-based checkpoint/restart prototype ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40 ` ntl
2011-02-28 23:40 ` [PATCH 03/10] Introduce has_locks_with_owner() helper ntl
     [not found]   ` <1298936432-29607-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-04-03 18:55     ` Serge E. Hallyn
2011-04-03 18:55   ` Serge E. Hallyn
2011-02-28 23:40 ` [PATCH 04/10] Introduce vfs_fcntl() helper ntl
     [not found]   ` <1298936432-29607-5-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-04-03 18:57     ` Serge E. Hallyn
2011-04-03 18:57   ` Serge E. Hallyn
2011-02-28 23:40 ` [PATCH 05/10] Core checkpoint/restart support code ntl
     [not found]   ` <1298936432-29607-6-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-04-03 19:03     ` Serge E. Hallyn
2011-04-03 19:03   ` Serge E. Hallyn
     [not found]     ` <20110403190324.GD15044-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-04 15:00       ` Nathan Lynch
2011-04-04 15:00     ` Nathan Lynch
2011-04-04 15:10       ` Serge E. Hallyn
2011-04-04 15:10       ` Serge E. Hallyn
     [not found]         ` <20110404151017.GA4857-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-04 15:40           ` Nathan Lynch
2011-04-04 15:40         ` Nathan Lynch
2011-04-04 16:27           ` Serge E. Hallyn
2011-04-04 17:41             ` Andrew Morton
     [not found]               ` <20110404104119.78189678.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-04-04 18:51                 ` Serge E. Hallyn
2011-04-04 18:51               ` Serge E. Hallyn
2011-04-04 19:42                 ` Andrew Morton
2011-04-04 20:29                   ` Serge E. Hallyn
2011-04-04 21:55                   ` Matt Helsley
2011-04-04 23:15                     ` Andrew Morton
     [not found]                     ` <20110404215511.GA27628-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2011-04-04 23:15                       ` Andrew Morton
2011-04-04 23:16                       ` Valdis.Kletnieks-PjAqaU27lzQ
2011-04-04 23:16                     ` Valdis.Kletnieks
2011-04-04 23:43                       ` Matt Helsley
2011-04-04 23:43                       ` Matt Helsley
2011-04-04 22:11                   ` Serge E. Hallyn
2011-04-04 22:53                   ` Serge E. Hallyn
     [not found]                   ` <20110404124222.fd5eb85b.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-04-04 20:29                     ` Serge E. Hallyn
2011-04-04 21:55                     ` Matt Helsley
2011-04-04 22:11                     ` Serge E. Hallyn
2011-04-04 22:53                     ` Serge E. Hallyn
     [not found]                 ` <20110404185119.GB4782-BtbdaCaBcfOTUehee3IRJA@public.gmane.org>
2011-04-04 19:42                   ` Andrew Morton
     [not found]             ` <20110404162753.GA3456-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-04 17:32               ` Oren Laadan
2011-04-04 17:32                 ` Oren Laadan
     [not found]                 ` <4D9A00B1.2080002-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-04-04 21:43                   ` Nathan Lynch
2011-04-04 21:43                 ` Nathan Lynch
2011-04-04 22:03                   ` Serge E. Hallyn
2011-04-04 23:42                     ` Dan Smith
2011-04-05  2:17                       ` Serge E. Hallyn
     [not found]                         ` <20110405021716.GA16672-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-05 19:18                           ` Nathan Lynch
2011-04-05 19:18                         ` Nathan Lynch
     [not found]                       ` <87vcyt4m93.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2011-04-05  2:17                         ` Serge E. Hallyn
     [not found]                     ` <20110404220309.GA10229-BtbdaCaBcfOTUehee3IRJA@public.gmane.org>
2011-04-04 23:42                       ` Dan Smith
2011-04-04 22:03                   ` Serge E. Hallyn
2011-04-04 22:29                   ` Matt Helsley
2011-04-04 22:29                   ` Matt Helsley
2011-04-04 17:41               ` Andrew Morton
2011-04-04 21:20               ` Nathan Lynch
2011-04-04 21:20             ` Nathan Lynch
2011-04-04 21:53               ` Serge E. Hallyn
2011-04-04 21:53               ` Serge E. Hallyn
2011-04-04 16:27           ` Serge E. Hallyn
2011-02-28 23:40 ` [PATCH 06/10] Checkpoint/restart mm support ntl
2011-02-28 23:40 ` [PATCH 07/10] Checkpoint/restart vfs support ntl
2011-02-28 23:40 ` [PATCH 08/10] Add generic '->checkpoint' f_op to ext filesystems ntl
2011-02-28 23:40 ` [PATCH 09/10] Add generic '->checkpoint()' f_op to simple char devices ntl
2011-02-28 23:40 ` [PATCH 10/10] x86_32 support for checkpoint/restart ntl
     [not found] ` <1298936432-29607-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-02-28 23:40   ` [PATCH 01/10] Make exec_mmap extern ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40     ` ntl
     [not found]     ` <1298936432-29607-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-04-03 16:56       ` Serge E. Hallyn
2011-04-03 16:56     ` Serge E. Hallyn
2011-02-28 23:40   ` [PATCH 02/10] Introduce mm_has_pending_aio() helper ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40     ` ntl
2011-03-01 15:40     ` Jeff Moyer [this message]
     [not found]       ` <x494o7mrgrh.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2011-03-01 16:04         ` Nathan Lynch
2011-03-01 16:04       ` Nathan Lynch
     [not found]     ` <1298936432-29607-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2011-03-01 15:40       ` Jeff Moyer
2011-02-28 23:40   ` [PATCH 03/10] Introduce has_locks_with_owner() helper ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 04/10] Introduce vfs_fcntl() helper ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 05/10] Core checkpoint/restart support code ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 06/10] Checkpoint/restart mm support ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 07/10] Checkpoint/restart vfs support ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 08/10] Add generic '->checkpoint' f_op to ext filesystems ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 09/10] Add generic '->checkpoint()' f_op to simple char devices ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-02-28 23:40   ` [PATCH 10/10] x86_32 support for checkpoint/restart ntl-e+AXbWqSrlAAvxtiuMwx3w
2011-03-01  1:08   ` [RFC 00/10] container-based checkpoint/restart prototype Nathan Lynch
2011-03-01  1:08 ` Nathan Lynch

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=x494o7mrgrh.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntl@pobox.com \
    --cc=orenl@cs.columbia.edu \
    /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.