All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Wang, Biao" <biao.wang@intel.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"arve@android.com" <arve@android.com>,
	"riandrews@android.com" <riandrews@android.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"Zhang, Di" <di.zhang@intel.com>, "Li, Fei" <fei.li@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] improve lmk to avoid deadlock issue
Date: Thu, 30 Jul 2015 05:29:17 -0700	[thread overview]
Message-ID: <1438259357.2677.23.camel@perches.com> (raw)
In-Reply-To: <20150730100937.GM5180@mwanda>

On Thu, 2015-07-30 at 13:09 +0300, Dan Carpenter wrote:
> > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
[]
> > @@ -127,11 +127,15 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
> >  		if (!p)
> >  			continue;
> >  
> > -		if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
> > -		    time_before_eq(jiffies, lowmem_deathpending_timeout)) {
> > -			task_unlock(p);
> > -			rcu_read_unlock();
> > -			return 0;
> > +		if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> > +			if (time_before_eq(jiffies, lowmem_deathpending_timeout)) {
> 
> 5) This goes over the 80 character limit.  Could you break it up like
> this:
> 
> 		if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> 			if (time_before_eq(jiffies,
> 					   lowmem_deathpending_timeout)) {
> 				task_unlock(p);
> 
> Anyway, thank for this patch.  Please fix these small process issues
> and resend.

Can the task_unlock in each branch be hoisted?

Another way to write this might be to use time_after:

		if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
			task_unlock(p);
			if (time_after(jiffies, lowmem_deathpending_timeout))
				continue;
			rcu_read_unlock();
			return 0;
		}



      reply	other threads:[~2015-07-30 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30  6:49 [PATCH] improve lmk to avoid deadlock issue Wang, Biao
2015-07-30 10:09 ` Dan Carpenter
2015-07-30 12:29   ` Joe Perches [this message]

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=1438259357.2677.23.camel@perches.com \
    --to=joe@perches.com \
    --cc=arve@android.com \
    --cc=biao.wang@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=di.zhang@intel.com \
    --cc=fei.li@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riandrews@android.com \
    /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.