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


Groups > linux.kernel > #1390265

Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when waiting on all pages writeback

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when waiting on all pages writeback
Date 2016-04-28 16:40 +0200
Message-ID <rsVgL-4Ob-43@gated-at.bofh.it> (permalink)
References <rsy0O-22y-19@gated-at.bofh.it> <rsC4p-5HB-1@gated-at.bofh.it> <rsSLU-2rx-13@gated-at.bofh.it> <rsUNI-4t4-19@gated-at.bofh.it> <rsVgK-4Ob-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Apr 28, 2016 at 10:30:55PM +0800, Chao Yu wrote:
> On 2016/4/28 22:03, Peter Zijlstra wrote:
> > On Thu, Apr 28, 2016 at 07:51:04PM +0800, Chao Yu wrote:
> >>> On Wed, Apr 27, 2016 at 09:41:48PM +0800, Chao Yu wrote:
> >>>> From: Chao Yu <yuchao0@huawei.com>
> >>>>
> >>>> The following condition can happen in a preemptible kernel, it may cause
> >>>> checkpointer hunging.
> >>>>
> >>>> CPU0:					CPU1:
> >>>>  - write_checkpoint
> >>>>   - do_checkpoint
> >>>>    - wait_on_all_pages_writeback
> >>>> 					 - f2fs_write_end_io
> >>>> 					  - wake_up
> >>>> 					this is last writebacked page, but
> >>>> 					no sleeper in sbi->cp_wait wait
> >>>> 					queue, wake_up is not been called.
> >>>>     - prepare_to_wait(TASK_UNINTERRUPTIBLE)
> >>>>     Here, current task can been preempted,
> >>>>     but there will be no waker since last
> >>>>     write_end_io has bypassed wake_up. So
> >>>>     current task will sleep forever.
> > 
> > But here, you should be verifying if you really should go sleep; as the
> > code did; it tests for !get_pages(, F2FS_WRITEBACK), and if you've just
> > completed that very last one, this will break out.
> 
> You mean after being preempted with TASK_UNINTERRUPTIBLE status, that task still
> has chance to be scheduled to check '!get_pages(, F2FS_WRITEBACK)', is that right?

Yes, preemption ignores task_struct::state.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RESEND 2/2] f2fs: disable preemption when waiting on all pages  writeback Chao Yu <chao@kernel.org> - 2016-04-27 15:50 +0200
  Re: [PATCH RESEND 2/2] f2fs: disable preemption when waiting on all  pages writeback Jaegeuk Kim <jaegeuk@kernel.org> - 2016-04-27 20:10 +0200
    Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when  waiting on all pages writeback Chao Yu <yuchao0@huawei.com> - 2016-04-28 14:00 +0200
      Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when  waiting on all pages writeback Peter Zijlstra <peterz@infradead.org> - 2016-04-28 16:10 +0200
        Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when  waiting on all pages writeback Chao Yu <chao@kernel.org> - 2016-04-28 16:40 +0200
          Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when  waiting on all pages writeback Peter Zijlstra <peterz@infradead.org> - 2016-04-28 16:40 +0200
            Re: [f2fs-dev] [PATCH RESEND 2/2] f2fs: disable preemption when  waiting on all pages writeback Chao Yu <chao@kernel.org> - 2016-04-28 17:10 +0200

csiph-web