@@ -209,13 +209,19 @@ EXPORT_SYMBOL_GPL(wakeup_source_remove);
/**
* wakeup_source_register - Create wakeup source and add it to the list.
* @dev: Device this wakeup source is associated with (or NULL if virtual).
- * @name: Name of the wakeup source to register.
+ * @fmt: format string for the wakeup source name
*/
struct wakeup_source *wakeup_source_register(struct device *dev,
- const char *name)
+ const char *fmt, ...)
{
struct wakeup_source *ws;
int ret;
+ char name[128];
+ va_list args;
+
+ va_start(args, fmt);
+ vsnprintf(name, sizeof(name), fmt, args);
+ va_end(args);
ws = wakeup_source_create(name);
if (ws) {
@@ -338,6 +338,7 @@ static void __init epoll_sysctls_init(void)
#define epoll_sysctls_init() do { } while (0)
#endif /* CONFIG_SYSCTL */
+static atomic_t wakesource_create_id = ATOMIC_INIT(0);
static const struct file_operations eventpoll_fops;
static inline int is_file_epoll(struct file *f)
@@ -1545,15 +1546,21 @@ static int ep_create_wakeup_source(struct epitem *epi)
{
struct name_snapshot n;
struct wakeup_source *ws;
+ pid_t task_pid;
+ int id;
+
+ task_pid = task_pid_nr(current);
if (!epi->ep->ws) {
- epi->ep->ws = wakeup_source_register(NULL, "eventpoll");
+ id = atomic_inc_return(&wakesource_create_id);
+ epi->ep->ws = wakeup_source_register(NULL, "epoll:%d:%d", id, task_pid);
if (!epi->ep->ws)
return -ENOMEM;
}
+ id = atomic_inc_return(&wakesource_create_id);
take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
- ws = wakeup_source_register(NULL, n.name.name);
+ ws = wakeup_source_register(NULL, "epollitem%d:%d.%s", id, task_pid, n.name.name);
release_dentry_name_snapshot(&n);
if (!ws)
@@ -100,7 +100,7 @@ extern void wakeup_source_destroy(struct wakeup_source *ws);
extern void wakeup_source_add(struct wakeup_source *ws);
extern void wakeup_source_remove(struct wakeup_source *ws);
extern struct wakeup_source *wakeup_source_register(struct device *dev,
- const char *name);
+ const char *fmt, ...);
extern void wakeup_source_unregister(struct wakeup_source *ws);
extern int wakeup_sources_read_lock(void);
extern void wakeup_sources_read_unlock(int idx);
@@ -141,7 +141,7 @@ static inline void wakeup_source_add(struct wakeup_source *ws) {}
static inline void wakeup_source_remove(struct wakeup_source *ws) {}
static inline struct wakeup_source *wakeup_source_register(struct device *dev,
- const char *name)
+ const char *fmt, ...)
{
return NULL;
}