Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752392AbdHVS4q (ORCPT ); Tue, 22 Aug 2017 14:56:46 -0400 Received: from merlin.infradead.org ([205.233.59.134]:59376 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbdHVS4p (ORCPT ); Tue, 22 Aug 2017 14:56:45 -0400 Date: Tue, 22 Aug 2017 20:56:24 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: "Liang, Kan" , Mel Gorman , Mel Gorman , "Kirill A. Shutemov" , Tim Chen , Ingo Molnar , Andi Kleen , Andrew Morton , Johannes Weiner , Jan Kara , linux-mm , Linux Kernel Mailing List Subject: Re: [PATCH 1/2] sched/wait: Break up long wake list walk Message-ID: <20170822185624.GN32112@worktop.programming.kicks-ass.net> References: <37D7C6CF3E00A74B8858931C1DB2F077537879BB@SHSMSX103.ccr.corp.intel.com> <20170818144622.oabozle26hasg5yo@techsingularity.net> <37D7C6CF3E00A74B8858931C1DB2F07753787AE4@SHSMSX103.ccr.corp.intel.com> <20170818185455.qol3st2nynfa47yc@techsingularity.net> <20170821183234.kzennaaw2zt2rbwz@techsingularity.net> <37D7C6CF3E00A74B8858931C1DB2F07753788B58@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F0775378A24A@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 646 Lines: 25 On Tue, Aug 22, 2017 at 11:19:12AM -0700, Linus Torvalds wrote: > diff --git a/mm/filemap.c b/mm/filemap.c > index a49702445ce0..75c29a1f90fb 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -991,13 +991,11 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q, > } > } > > - if (lock) { > - if (!test_and_set_bit_lock(bit_nr, &page->flags)) > - break; > - } else { > - if (!test_bit(bit_nr, &page->flags)) > - break; > - } > + if (!lock) > + break; > + > + if (!test_and_set_bit_lock(bit_nr, &page->flags)) > + break; > } Won't we now prematurely terminate the wait when we get a spurious wakeup?