Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580364 > unrolled thread

[PATCH v3 0/9] Don't reinvent the wheel but use existing llist API

Started byByungchul Park <byungchul.park@lge.com>
First post2017-02-14 08:30 +0100
Last post2017-02-22 06:10 +0100
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/9] Don't reinvent the wheel but use existing llist API Byungchul Park <byungchul.park@lge.com> - 2017-02-14 08:30 +0100
    [PATCH v3 6/9] namespace.c: Don't reinvent the wheel but use existing llist API Byungchul Park <byungchul.park@lge.com> - 2017-02-14 08:30 +0100
    [PATCH v3 8/9] sched: Don't reinvent the wheel but use existing llist API Byungchul Park <byungchul.park@lge.com> - 2017-02-14 08:30 +0100
      Re: [PATCH v3 8/9] sched: Don't reinvent the wheel but use existing  llist API Byungchul Park <byungchul.park@lge.com> - 2017-02-22 06:10 +0100

#1580364 — [PATCH v3 0/9] Don't reinvent the wheel but use existing llist API

FromByungchul Park <byungchul.park@lge.com>
Date2017-02-14 08:30 +0100
Subject[PATCH v3 0/9] Don't reinvent the wheel but use existing llist API
Message-ID<taFIJ-759-3@gated-at.bofh.it>
Change from v2
- replace for_each(wake_list) with the safe version in scheduler.
- fix a trivial comment in llist.h

Change from v1
- split one patch to several ones, one for each subsystem.
- replace for_each with the safe version where it's necessary.

Byungchul Park (9):
  llist: Provide a safe version for llist_for_each
  bcache: Don't reinvent the wheel but use existing llist API
  raid5: Don't reinvent the wheel but use existing llist API
  vhost/scsi: Don't reinvent the wheel but use existing llist API
  fput: Don't reinvent the wheel but use existing llist API
  namespace.c: Don't reinvent the wheel but use existing llist API
  irq_work: Don't reinvent the wheel but use existing llist API
  sched: Don't reinvent the wheel but use existing llist API
  mm: Don't reinvent the wheel but use existing llist API

 drivers/md/bcache/closure.c | 17 +++--------------
 drivers/md/raid5.c          |  6 ++----
 drivers/vhost/scsi.c        | 11 +++--------
 fs/file_table.c             | 12 +++++-------
 fs/namespace.c              | 12 +++++-------
 include/linux/llist.h       | 19 +++++++++++++++++++
 kernel/irq_work.c           |  6 +-----
 kernel/sched/core.c         | 13 ++-----------
 mm/vmalloc.c                | 10 ++++------
 9 files changed, 44 insertions(+), 62 deletions(-)

-- 
1.9.1

*** BLURB HERE ***

Byungchul Park (9):
  llist: Provide a safe version for llist_for_each
  bcache: Don't reinvent the wheel but use existing llist API
  raid5: Don't reinvent the wheel but use existing llist API
  vhost/scsi: Don't reinvent the wheel but use existing llist API
  fput: Don't reinvent the wheel but use existing llist API
  namespace.c: Don't reinvent the wheel but use existing llist API
  irq_work: Don't reinvent the wheel but use existing llist API
  sched: Don't reinvent the wheel but use existing llist API
  mm: Don't reinvent the wheel but use existing llist API

 drivers/md/bcache/closure.c | 17 +++--------------
 drivers/md/raid5.c          |  6 ++----
 drivers/vhost/scsi.c        | 11 +++--------
 fs/file_table.c             | 12 +++++-------
 fs/namespace.c              | 12 +++++-------
 include/linux/llist.h       | 19 +++++++++++++++++++
 kernel/irq_work.c           |  6 +-----
 kernel/sched/core.c         | 15 +++------------
 mm/vmalloc.c                | 10 ++++------
 9 files changed, 45 insertions(+), 63 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1580366 — [PATCH v3 6/9] namespace.c: Don't reinvent the wheel but use existing llist API

FromByungchul Park <byungchul.park@lge.com>
Date2017-02-14 08:30 +0100
Subject[PATCH v3 6/9] namespace.c: Don't reinvent the wheel but use existing llist API
Message-ID<taFIK-759-27@gated-at.bofh.it>
In reply to#1580364
Although llist provides proper APIs, they are not used. Make them used.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 fs/namespace.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index b5b1259..5cb2229 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1082,12 +1082,10 @@ static void __cleanup_mnt(struct rcu_head *head)
 static void delayed_mntput(struct work_struct *unused)
 {
 	struct llist_node *node = llist_del_all(&delayed_mntput_list);
-	struct llist_node *next;
+	struct mount *m, *t;
 
-	for (; node; node = next) {
-		next = llist_next(node);
-		cleanup_mnt(llist_entry(node, struct mount, mnt_llist));
-	}
+	llist_for_each_entry_safe(m, t, node, mnt_llist)
+		cleanup_mnt(m);
 }
 static DECLARE_DELAYED_WORK(delayed_mntput_work, delayed_mntput);
 
@@ -1615,7 +1613,7 @@ void __detach_mounts(struct dentry *dentry)
 	namespace_unlock();
 }
 
-/* 
+/*
  * Is the caller allowed to modify his namespace?
  */
 static inline bool may_mount(void)
@@ -2159,7 +2157,7 @@ static int do_loopback(struct path *path, const char *old_name,
 
 	err = -EINVAL;
 	if (mnt_ns_loop(old_path.dentry))
-		goto out; 
+		goto out;
 
 	mp = lock_mount(path);
 	err = PTR_ERR(mp);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1580367 — [PATCH v3 8/9] sched: Don't reinvent the wheel but use existing llist API

FromByungchul Park <byungchul.park@lge.com>
Date2017-02-14 08:30 +0100
Subject[PATCH v3 8/9] sched: Don't reinvent the wheel but use existing llist API
Message-ID<taFIK-759-25@gated-at.bofh.it>
In reply to#1580364
Although llist provides proper APIs, they are not used. Make them used.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/sched/core.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d01f9d0..8938125 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1773,7 +1773,7 @@ void sched_ttwu_pending(void)
 {
 	struct rq *rq = this_rq();
 	struct llist_node *llist = llist_del_all(&rq->wake_list);
-	struct task_struct *p;
+	struct task_struct *p, *t;
 	unsigned long flags;
 	struct rq_flags rf;
 
@@ -1783,17 +1783,8 @@ void sched_ttwu_pending(void)
 	raw_spin_lock_irqsave(&rq->lock, flags);
 	rq_pin_lock(rq, &rf);
 
-	while (llist) {
-		int wake_flags = 0;
-
-		p = llist_entry(llist, struct task_struct, wake_entry);
-		llist = llist_next(llist);
-
-		if (p->sched_remote_wakeup)
-			wake_flags = WF_MIGRATED;
-
-		ttwu_do_activate(rq, p, wake_flags, &rf);
-	}
+	llist_for_each_entry_safe(p, t, llist, wake_entry)
+		ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
 
 	rq_unpin_lock(rq, &rf);
 	raw_spin_unlock_irqrestore(&rq->lock, flags);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1585920 — Re: [PATCH v3 8/9] sched: Don't reinvent the wheel but use existing llist API

FromByungchul Park <byungchul.park@lge.com>
Date2017-02-22 06:10 +0100
SubjectRe: [PATCH v3 8/9] sched: Don't reinvent the wheel but use existing llist API
Message-ID<tdxlD-4U0-3@gated-at.bofh.it>
In reply to#1580367
On Tue, Feb 14, 2017 at 04:26:29PM +0900, Byungchul Park wrote:
> Although llist provides proper APIs, they are not used. Make them used.

Hello,

What do you think?

> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  kernel/sched/core.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d01f9d0..8938125 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1773,7 +1773,7 @@ void sched_ttwu_pending(void)
>  {
>  	struct rq *rq = this_rq();
>  	struct llist_node *llist = llist_del_all(&rq->wake_list);
> -	struct task_struct *p;
> +	struct task_struct *p, *t;
>  	unsigned long flags;
>  	struct rq_flags rf;
>  
> @@ -1783,17 +1783,8 @@ void sched_ttwu_pending(void)
>  	raw_spin_lock_irqsave(&rq->lock, flags);
>  	rq_pin_lock(rq, &rf);
>  
> -	while (llist) {
> -		int wake_flags = 0;
> -
> -		p = llist_entry(llist, struct task_struct, wake_entry);
> -		llist = llist_next(llist);
> -
> -		if (p->sched_remote_wakeup)
> -			wake_flags = WF_MIGRATED;
> -
> -		ttwu_do_activate(rq, p, wake_flags, &rf);
> -	}
> +	llist_for_each_entry_safe(p, t, llist, wake_entry)
> +		ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
>  
>  	rq_unpin_lock(rq, &rf);
>  	raw_spin_unlock_irqrestore(&rq->lock, flags);
> -- 
> 1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web