Re: [PATCH] improve lmk to avoid deadlock issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
		}


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux