All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cedric Le Goater <legoater-GANU6spQydw@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [RFC][PATCH] checkpoint/restart: Add support for epoll
Date: Wed, 15 Jul 2009 11:22:36 +0200	[thread overview]
Message-ID: <4A5D9FDC.7000309@free.fr> (raw)
In-Reply-To: <20090714235405.GH5213-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>

On 07/15/2009 01:54 AM, Matt Helsley wrote:
>   Add checkpoint/restart support for epoll files. This is the minimum
>   support necessary to recreate the epoll item sets without any pending
>   events.
>
>   This is an RFC to show where I'm going with the patch and give an idea
>   of how much code I expect it will take. Compiles and boots on x86 but
>   I haven't tested it.
>
>   Caveats: Does not correctly support restoring epoll fds to epoll sets
> 	  as this requires some recursion detection/avoidance. See the
> 	  "TODO" that mentions deferqueues.

it all depends on the algorithm of C/R for files.

the 'contents', the watched fds in your case, of the 'struct file' should be
restored after all the struct files have been restored. you'll have the same
issue with other fd types.

Also,I think it it possible to add 2 epoll services providing get and set without
mixing the epoll code with C/R code. ugly, IHMO. something like :

	diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
	index f6856a5..b19b7a1 100644
	--- a/include/linux/eventpoll.h
	+++ b/include/linux/eventpoll.h
	@@ -49,6 +49,12 @@ struct epoll_event {
	        __u64 data;
	 } EPOLL_PACKED;
  
	+struct epoll_fd_event {
	+       int fd;
	+       struct file* file;
	+       struct epoll_event event;
	+} EPOLL_PACKED;
	+
	 #ifdef __KERNEL__
	
	 /* Forward declarations to avoid compiler errors */
	@@ -95,6 +101,9 @@ static inline void eventpoll_release(struct file *file)
	        eventpoll_release_file(file);
	 }
  
	+extern int eventpoll_get_events(int, struct epoll_fd_event *, int);
	+extern int eventpoll_insert(int, int, struct file*, struct epoll_event *);
	+
	 #else
	
	 static inline void eventpoll_init_file(struct file *file) {}

finally,


> +	/*
> +	 * FIXME for now we do it one at a time. Later we might do it like
> +	 * checkpoint_pids() for better performance since there can be many
> +	 * more epoll items than pids.
> +	 */
> +	cepi = ckpt_hdr_get(ctx, sizeof(*cepi));
> +	for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
> +		struct epitem *epi = rb_entry(rbp, struct epitem, rbn);
> +		cepi->fd = epi->ffd.fd;

epi->ffd.fd and epi->ffd.file are not necessarily related. fd could have been
recycled after the EPOLL_CTL_ADD. nop ? and it will break the restart.

C.

  parent reply	other threads:[~2009-07-15  9:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 23:54 [RFC][PATCH] checkpoint/restart: Add support for epoll Matt Helsley
     [not found] ` <20090714235405.GH5213-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-07-15  9:22   ` Cedric Le Goater [this message]
2009-07-24  8:35   ` Oren Laadan
     [not found]     ` <4A697242.60606-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-07-24 17:04       ` Matt Helsley
     [not found]         ` <20090724170401.GG5878-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-07-24 17:22           ` Oren Laadan

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=4A5D9FDC.7000309@free.fr \
    --to=legoater-ganu6spqydw@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.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.