All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] list_lru: don't call list_lru_from_kmem if the list_head is empty
Date: Wed, 19 Aug 2015 17:25:36 +0300	[thread overview]
Message-ID: <20150819142536.GP21209@esperanza> (raw)
In-Reply-To: <1439993140-13362-1-git-send-email-jeff.layton@primarydata.com>

On Wed, Aug 19, 2015 at 10:05:40AM -0400, Jeff Layton wrote:
> If the list_head is empty then we'll have called list_lru_from_kmem
> for nothing. Move that call inside of the list_empty if block.
> 
> Cc: Vladimir Davydov <vdavydov@parallels.com>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>

Reviewed-by: Vladimir Davydov <vdavydov@parallels.com>

> ---
>  mm/list_lru.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/list_lru.c b/mm/list_lru.c
> index 909eca2c820e..e1da19fac1b3 100644
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -99,8 +99,8 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item)
>  	struct list_lru_one *l;
>  
>  	spin_lock(&nlru->lock);
> -	l = list_lru_from_kmem(nlru, item);
>  	if (list_empty(item)) {
> +		l = list_lru_from_kmem(nlru, item);
>  		list_add_tail(item, &l->list);
>  		l->nr_items++;
>  		spin_unlock(&nlru->lock);
> @@ -118,8 +118,8 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item)
>  	struct list_lru_one *l;
>  
>  	spin_lock(&nlru->lock);
> -	l = list_lru_from_kmem(nlru, item);
>  	if (!list_empty(item)) {
> +		l = list_lru_from_kmem(nlru, item);
>  		list_del_init(item);
>  		l->nr_items--;
>  		spin_unlock(&nlru->lock);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] list_lru: don't call list_lru_from_kmem if the list_head is empty
Date: Wed, 19 Aug 2015 17:25:36 +0300	[thread overview]
Message-ID: <20150819142536.GP21209@esperanza> (raw)
In-Reply-To: <1439993140-13362-1-git-send-email-jeff.layton@primarydata.com>

On Wed, Aug 19, 2015 at 10:05:40AM -0400, Jeff Layton wrote:
> If the list_head is empty then we'll have called list_lru_from_kmem
> for nothing. Move that call inside of the list_empty if block.
> 
> Cc: Vladimir Davydov <vdavydov@parallels.com>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>

Reviewed-by: Vladimir Davydov <vdavydov@parallels.com>

> ---
>  mm/list_lru.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/list_lru.c b/mm/list_lru.c
> index 909eca2c820e..e1da19fac1b3 100644
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -99,8 +99,8 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item)
>  	struct list_lru_one *l;
>  
>  	spin_lock(&nlru->lock);
> -	l = list_lru_from_kmem(nlru, item);
>  	if (list_empty(item)) {
> +		l = list_lru_from_kmem(nlru, item);
>  		list_add_tail(item, &l->list);
>  		l->nr_items++;
>  		spin_unlock(&nlru->lock);
> @@ -118,8 +118,8 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item)
>  	struct list_lru_one *l;
>  
>  	spin_lock(&nlru->lock);
> -	l = list_lru_from_kmem(nlru, item);
>  	if (!list_empty(item)) {
> +		l = list_lru_from_kmem(nlru, item);
>  		list_del_init(item);
>  		l->nr_items--;
>  		spin_unlock(&nlru->lock);

  reply	other threads:[~2015-08-19 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 14:05 [PATCH] list_lru: don't call list_lru_from_kmem if the list_head is empty Jeff Layton
2015-08-19 14:05 ` Jeff Layton
2015-08-19 14:25 ` Vladimir Davydov [this message]
2015-08-19 14:25   ` Vladimir Davydov

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=20150819142536.GP21209@esperanza \
    --to=vdavydov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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.