SCHED: remove proliferation of wait_on_bit action functions.
Subsystems (19)
PATCH 1/1 SCHED: remove proliferation of wait_on_bit action functions.
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]
The current "wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which uses io_schedule() and one which just uses schedule().
So:
Rename wait_on_bit and wait_on_bit_lock to
wait_on_bit_action and wait_on_bit_lock_action
to make it explicit that they need an action function.
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
All instances of the old wait_on_bit and wait_on_bit_lock which can use the new version have been changed accordingly and their action functions have been discarded. wait_on_bit{_lock} does not return any specific error code in the event of a signal so the caller must check for non-zero and interpolate their own error code as appropriate.
The wait_on_bit() call in __fscache_wait_on_invalidate() was ambiguous as it specified TASK_UNINTERRUPTIBLE but used fscache_wait_bit_interruptible as an action function.
As any error return is never checked I assumed that 'uninterruptible' was correct.
The main remaining user of wait_on_bit{,_lock}_action is NFS which needs to use a freezer-aware schedule() call.
A comment in fs/gfs2/glock.c notes that having multiple 'action' functions is useful as they display differently in the 'wchan' field of 'ps'. (and /proc/$PID/wchan).
As the new bit_wait{,_io} functions are tagged "__sched", they will not show up at all, but something higher in the stack. So the distinction will still be visible, only with different function names (gds2_glock_wait versus gfs2_glock_dq_wait in the gfs2/glock.c case).
Documentation/filesystems/caching/operations.txt +1 -1
@@ -90,7 +90,7 @@ operations: to be cleared before proceeding: wait_on_bit(&op->flags, FSCACHE_OP_WAITING, - fscache_wait_bit, TASK_UNINTERRUPTIBLE); + TASK_UNINTERRUPTIBLE); (2) The operation may be fast asynchronous (FSCACHE_OP_FAST), in which case it
drivers/md/dm-bufio.c +15 -27
93 lines not on this page · raw message
drivers/md/dm-snap.c +1 -8
@@ -1032,20 +1032,13 @@ static void start_merge(struct dm_snapshot *s)snapshot_merge_next_chunks (s); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -/* * Stop the merging process and wait until it finishes. */ static void stop_merge (struct dm_snapshot *s) {set_bit (SHUTDOWN_MERGE , &s->state_bits); -wait_on_bit (&s->state_bits,RUNNING_MERGE , wait_schedule, +wait_on_bit (&s->state_bits,RUNNING_MERGE ,TASK_UNINTERRUPTIBLE );clear_bit (SHUTDOWN_MERGE , &s->state_bits); }
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +2 -9
@@ -253,13 +253,6 @@ static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)return usb_urb_exitv2 (&adap->stream); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -static int dvb_usb_start_feed (struct dvb_demux_feed *dvbdmxfeed) {struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
@@ -273,7 +266,7 @@ static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) dvbdmxfeed->pid, dvbdmxfeed->index);/* wait init is done */ -wait_on_bit (&adap->state_bits,ADAP_INIT , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_INIT ,TASK_UNINTERRUPTIBLE );if (adap->active_fe ==-1 )
@@ -568,7 +561,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)if (!adap->suspend_resume_active) {set_bit (ADAP_SLEEP , &adap->state_bits); -wait_on_bit (&adap->state_bits,ADAP_STREAMING , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_STREAMING ,TASK_UNINTERRUPTIBLE ); }
fs/btrfs/extent_io.c +2 -8
@@ -3373,16 +3373,10 @@ done_unlocked:return 0 ; } -static int eb_wait (void *word) -{ -io_schedule (); -return 0 ; -} -void wait_on_extent_buffer_writeback (struct extent_buffer *eb) { -wait_on_bit (&eb->bflags,EXTENT_BUFFER_WRITEBACK , eb_wait, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&eb->bflags,EXTENT_BUFFER_WRITEBACK , +TASK_UNINTERRUPTIBLE ); } static int lock_extent_buffer_for_io(struct extent_buffer *eb,
fs/buffer.c +2 -9
@@ -61,16 +61,9 @@ inline void touch_buffer(struct buffer_head *bh) }EXPORT_SYMBOL (touch_buffer); -static int sleep_on_buffer (void *word) -{ -io_schedule (); -return 0 ; -} -void __lock_buffer (struct buffer_head *bh) { -wait_on_bit_lock (&bh->b_state, BH_Lock, sleep_on_buffer, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_lock_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_buffer);
@@ -123,7 +116,7 @@ EXPORT_SYMBOL(buffer_check_dirty_writeback);*/ void __wait_on_buffer (struct buffer_head * bh) { -wait_on_bit (&bh->b_state, BH_Lock, sleep_on_buffer,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__wait_on_buffer);
fs/cifs/connect.c +1 -9
@@ -3931,13 +3931,6 @@ cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)return tlink_tcon (cifs_sb_master_tlink (cifs_sb)); } -static int -cifs_sb_tcon_pending_wait (void *unused) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/* find and return a tlink with given uid */ static struct tcon_link *tlink_rb_search (struct rb_root *root,kuid_t uid)
@@ -4036,11 +4029,10 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb) }else { wait_for_construction: ret =wait_on_bit (&tlink->tl_flags,TCON_LINK_PENDING , - cifs_sb_tcon_pending_wait,TASK_INTERRUPTIBLE );if (ret) {cifs_put_tlink (tlink); -return ERR_PTR (ret); +return ERR_PTR (-ERESTARTSYS ); }/* if it's good, return it */
fs/fs-writeback.c +2 -1
@@ -342,7 +342,8 @@ static void __inode_wait_for_writeback(struct inode *inode) wqh =bit_waitqueue (&inode->i_state, __I_SYNC);while (inode->i_state &I_SYNC ) {spin_unlock (&inode->i_lock); -__wait_on_bit (wqh, &wq, inode_wait,TASK_UNINTERRUPTIBLE ); +__wait_on_bit (wqh, &wq, bit_wait, +TASK_UNINTERRUPTIBLE );spin_lock (&inode->i_lock); } }
fs/fscache/cookie.c +3 -4
@@ -160,7 +160,7 @@ void __fscache_enable_cookie(struct fscache_cookie *cookie,_enter ("%p" , cookie);wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (test_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock;
@@ -255,7 +255,7 @@ static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie)if (!fscache_defer_lookup) {_debug ("non-deferred lookup %p" , &cookie->flags);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );_debug ("complete" );if (test_bit (FSCACHE_COOKIE_UNAVAILABLE , &cookie->flags)) goto unavailable;
@@ -463,7 +463,6 @@ void __fscache_wait_on_invalidate(struct fscache_cookie *cookie)_enter ("%p" , cookie);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_INVALIDATING , - fscache_wait_bit_interruptible,TASK_UNINTERRUPTIBLE );_leave ("" );
@@ -525,7 +524,7 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) }wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (!test_and_clear_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock_enable;
fs/fscache/internal.h +0 -2
@@ -91,8 +91,6 @@ static inline bool fscache_object_congested(void)return workqueue_congested (WORK_CPU_UNBOUND , fscache_object_wq); } -extern int fscache_wait_bit (void *); -extern int fscache_wait_bit_interruptible (void *);extern int fscache_wait_atomic_t (atomic_t *);/*
fs/fscache/main.c +0 -18
@@ -198,24 +198,6 @@ static void __exit fscache_exit(void)module_exit (fscache_exit);/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -int fscache_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -int fscache_wait_bit_interruptible (void *flags) -{ -schedule (); -return signal_pending (current); -} - -/* * wait_on_atomic_t() sleep function for uninterruptible waiting */ int fscache_wait_atomic_t (atomic_t *p)
fs/fscache/page.c +1 -3
@@ -298,7 +298,6 @@ int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie) jif = jiffies;if (wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) {fscache_stat (&fscache_n_retrievals_intr);_leave (" = -ERESTARTSYS" );
@@ -342,7 +341,6 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,if (stat_op_waits)fscache_stat (stat_op_waits);if (wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) { ret =fscache_cancel_op (op, do_cancel);if (ret ==0 )
@@ -351,7 +349,7 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,/* it's been removed from the pending queue by another party, * so we should get to run shortly */ wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); }_debug ("<<< GO" );
fs/gfs2/glock.c +2 -23
@@ -856,27 +856,6 @@ void gfs2_holder_uninit(struct gfs2_holder *gh) }/** -* gfs2_glock_holder_wait -* @word: unused -* -* This function and gfs2_glock_demote_wait both show up in the WCHAN -* field. Thus I've separated these otherwise identical functions in -* order to be more informative to the user. -*/ - -static int gfs2_glock_holder_wait (void *word) -{ -schedule (); -return 0 ; -} - -static int gfs2_glock_demote_wait (void *word) -{ -schedule (); -return 0 ; -} - -/** * gfs2_glock_wait - wait on a glock acquisition * @gh: the glock holder *
@@ -888,7 +867,7 @@ int gfs2_glock_wait(struct gfs2_holder *gh)unsigned long time1 = jiffies;might_sleep (); -wait_on_bit (&gh->gh_iflags,HIF_WAIT , gfs2_glock_holder_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gh->gh_iflags,HIF_WAIT ,TASK_UNINTERRUPTIBLE );if (time_after (jiffies, time1 +HZ ))/* have we waited > a second? */ /* Lengthen the minimum hold time. */ gh->gh_gl->gl_hold_time = min(gh->gh_gl->gl_hold_time +
@@ -1128,7 +1107,7 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh)struct gfs2_glock *gl = gh->gh_gl;gfs2_glock_dq (gh);might_sleep (); -wait_on_bit (&gl->gl_flags,GLF_DEMOTE , gfs2_glock_demote_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gl->gl_flags,GLF_DEMOTE ,TASK_UNINTERRUPTIBLE ); }/**
fs/gfs2/lock_dlm.c +1 -7
@@ -936,12 +936,6 @@ fail:return error; } -static int dlm_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -static int control_first_done (struct gfs2_sbd *sdp) {struct lm_lockstruct *ls = &sdp->sd_lockstruct;
@@ -976,7 +970,7 @@ restart:fs_info (sdp,"control_first_done wait gen %u\n" , start_gen);wait_on_bit (&ls->ls_recover_flags,DFL_DLM_RECOVERY , - dlm_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }
fs/gfs2/ops_fstype.c +2 -9
@@ -1010,20 +1010,13 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp) lm->lm_unmount (sdp); } -static int gfs2_journalid_wait (void *word) -{ -if (signal_pending (current)) -return -EINTR ; -schedule (); -return 0 ; -} -static int wait_on_journal (struct gfs2_sbd *sdp) {if (sdp->sd_lockstruct.ls_ops->lm_mount ==NULL )return 0 ; -return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID , gfs2_journalid_wait,TASK_INTERRUPTIBLE ); +return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID ,TASK_INTERRUPTIBLE ) + ? -EINTR :0 ; }void gfs2_online_uevent (struct gfs2_sbd *sdp)
fs/gfs2/recovery.c +1 -7
@@ -591,12 +591,6 @@ done:wake_up_bit (&jd->jd_flags,JDF_RECOVERY ); } -static int gfs2_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -int gfs2_recover_journal (struct gfs2_jdesc *jd,bool wait) {int rv;
@@ -609,7 +603,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)BUG_ON (!rv);if (wait) -wait_on_bit (&jd->jd_flags,JDF_RECOVERY , gfs2_recovery_wait, +wait_on_bit (&jd->jd_flags,JDF_RECOVERY ,TASK_UNINTERRUPTIBLE );return wait ? jd->jd_recover_error :0 ;
fs/gfs2/super.c +1 -7
@@ -850,12 +850,6 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)return error; } -static int gfs2_umount_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -/** * gfs2_put_super - Unmount the filesystem * @sb: The VFS superblock
@@ -880,7 +874,7 @@ restart:continue ;spin_unlock (&sdp->sd_jindex_spin);wait_on_bit (&jd->jd_flags,JDF_RECOVERY , - gfs2_umount_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }spin_unlock (&sdp->sd_jindex_spin);
fs/inode.c +0 -7
@@ -1695,13 +1695,6 @@ int inode_needs_sync(struct inode *inode) }EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) -{ -schedule (); -return 0 ; -} -EXPORT_SYMBOL (inode_wait); -/* * If we try to find an inode in the inode hash while it is being * deleted, we have to wait until the filesystem completes its
fs/jbd2/transaction.c +2 -8
@@ -763,12 +763,6 @@ static void warn_dirty_buffer(struct buffer_head *bh) bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr); } -static int sleep_on_shadow_bh (void *word) -{ -io_schedule (); -return 0 ; -} -/* * If the buffer is already part of the current transaction, then there * is nothing we need to do. If it is already part of a prior
@@ -906,8 +900,8 @@ repeat:if (buffer_shadow (bh)) {JBUFFER_TRACE (jh,"on shadow: sleep" );jbd_unlock_bh_state (bh); -wait_on_bit (&bh->b_state, BH_Shadow, - sleep_on_shadow_bh,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Shadow, +TASK_UNINTERRUPTIBLE ); goto repeat; }
fs/nfs/file.c +2 -2
@@ -362,8 +362,8 @@ start:* Prevent starvation issues if someone is doing a consistency * sync-to-disk */ - ret =wait_on_bit (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret)return ret;
fs/nfs/inode.c +2 -2
@@ -1061,8 +1061,8 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)* the bit lock here if it looks like we're going to be doing that. */ for (;;) { - ret =wait_on_bit (bitlock,NFS_INO_INVALIDATING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (bitlock,NFS_INO_INVALIDATING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret) goto out;spin_lock (&inode->i_lock);
fs/nfs/nfs4filelayoutdev.c +2 -2
@@ -783,8 +783,8 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j)static void nfs4_wait_ds_connect (struct nfs4_pnfs_ds *ds) {might_sleep (); -wait_on_bit (&ds->ds_state,NFS4DS_CONNECTING , - nfs_wait_bit_killable,TASK_KILLABLE ); +wait_on_bit_action (&ds->ds_state,NFS4DS_CONNECTING , + nfs_wait_bit_killable,TASK_KILLABLE ); }static void nfs4_clear_ds_conn_bit (struct nfs4_pnfs_ds *ds)
fs/nfs/nfs4state.c +2 -2
@@ -1251,8 +1251,8 @@ int nfs4_wait_clnt_recover(struct nfs_client *clp)might_sleep ();atomic_inc (&clp->cl_count); - res =wait_on_bit (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , - nfs_wait_bit_killable,TASK_KILLABLE ); + res =wait_on_bit_action (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , + nfs_wait_bit_killable,TASK_KILLABLE );if (res) goto out;if (clp->cl_cons_state <0 )
fs/nfs/pagelist.c +2 -9
@@ -258,12 +258,6 @@ void nfs_release_request(struct nfs_page *req)kref_put (&req->wb_kref, nfs_free_request); } -static int nfs_wait_bit_uninterruptible (void *word) -{ -io_schedule (); -return 0 ; -} -/** * nfs_wait_on_request - Wait for a request to complete. * @req: request to wait upon.
@@ -274,9 +268,8 @@ static int nfs_wait_bit_uninterruptible(void *word)int nfs_wait_on_request (struct nfs_page *req) { -return wait_on_bit (&req->wb_flags,PG_BUSY , - nfs_wait_bit_uninterruptible, -TASK_UNINTERRUPTIBLE ); +return wait_on_bit_io (&req->wb_flags,PG_BUSY , +TASK_UNINTERRUPTIBLE ); }bool nfs_generic_pg_test (struct nfs_pageio_descriptor *desc,struct nfs_page *prev,struct nfs_page *req)
fs/nfs/pnfs.c +1 -1
@@ -1913,7 +1913,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)if (test_and_set_bit (NFS_INO_LAYOUTCOMMITTING , &nfsi->flags)) {if (!sync) goto out; - status =wait_on_bit_lock (&nfsi->flags, + status =wait_on_bit_lock_action (&nfsi->flags,NFS_INO_LAYOUTCOMMITTING , nfs_wait_bit_killable,TASK_KILLABLE );
fs/nfs/write.c +2 -2
@@ -393,7 +393,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)int err;/* Stop dirtying of new pages while we sync */ - err =wait_on_bit_lock (bitlock,NFS_INO_FLUSHING , + err =wait_on_bit_lock_action (bitlock,NFS_INO_FLUSHING , nfs_wait_bit_killable,TASK_KILLABLE );if (err) goto out_err;
@@ -1694,7 +1694,7 @@ int nfs_commit_inode(struct inode *inode, int how)return error;if (!may_wait) goto out_mark_dirty; - error =wait_on_bit (&NFS_I (inode)->flags, + error =wait_on_bit_action (&NFS_I (inode)->flags,NFS_INO_COMMIT , nfs_wait_bit_killable,TASK_KILLABLE );
include/linux/wait.h +111 -4
147 lines not on this page · raw message
include/linux/writeback.h +1 -2
@@ -90,7 +90,6 @@ struct writeback_control {* fs/fs-writeback.c */ struct bdi_writeback ; -int inode_wait (void *);void writeback_inodes_sb (struct super_block *,enum wb_reason reason);void writeback_inodes_sb_nr (struct super_block *,unsigned long nr,enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);static inline void wait_on_inode (struct inode *inode) {might_sleep (); -wait_on_bit (&inode->i_state, __I_NEW, inode_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&inode->i_state, __I_NEW,TASK_UNINTERRUPTIBLE ); }/*
kernel/ptrace.c +1 -7
@@ -28,12 +28,6 @@#include <linux/compat.h> -static int ptrace_trapping_sleep_fn (void *flags) -{ -schedule (); -return 0 ; -} -/* * ptrace a task: make the debugger its new parent and * move it to the ptrace list.
@@ -371,7 +365,7 @@ unlock_creds: out:if (!retval) {wait_on_bit (&task->jobctl,JOBCTL_TRAPPING_BIT , - ptrace_trapping_sleep_fn,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );proc_ptrace_connector (task,PTRACE_ATTACH ); }
kernel/sched/wait.c +18 -0
@@ -502,3 +502,21 @@ void wake_up_atomic_t(atomic_t *p)__wake_up_bit (atomic_t_waitqueue (p), p,WAIT_ATOMIC_T_BIT_NR ); }EXPORT_SYMBOL (wake_up_atomic_t); + +__sched int bit_wait(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait); + +__sched int bit_wait_io(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +io_schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait_io);
mm/filemap.c +4 -16
@@ -241,18 +241,6 @@ void delete_from_page_cache(struct page *page) }EXPORT_SYMBOL (delete_from_page_cache); -static int sleep_on_page (void *word) -{ -io_schedule (); -return 0 ; -} - -static int sleep_on_page_killable (void *word) -{ -sleep_on_page (word); -return fatal_signal_pending (current) ? -EINTR :0 ; -} -static int filemap_check_errors (struct address_space *mapping) {int ret =0 ;
@@ -690,7 +678,7 @@ void wait_on_page_bit(struct page *page, int bit_nr)DEFINE_WAIT_BIT (wait, &page->flags, bit_nr);if (test_bit (bit_nr, &page->flags)) -__wait_on_bit (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (wait_on_page_bit);
@@ -703,7 +691,7 @@ int wait_on_page_bit_killable(struct page *page, int bit_nr)return 0 ;return __wait_on_bit (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }/**
@@ -770,7 +758,7 @@ void __lock_page(struct page *page) {DEFINE_WAIT_BIT (wait, &page->flags, PG_locked); -__wait_on_bit_lock (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit_lock (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_page);
@@ -780,7 +768,7 @@ int __lock_page_killable(struct page *page)DEFINE_WAIT_BIT (wait, &page->flags, PG_locked);return __wait_on_bit_lock (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }EXPORT_SYMBOL_GPL (__lock_page_killable);
mm/ksm.c +1 -7
@@ -1979,18 +1979,12 @@ void ksm_migrate_page(struct page *newpage, struct page *oldpage)#endif /* CONFIG_MIGRATION */ #ifdef CONFIG_MEMORY_HOTREMOVE -static int just_wait (void *word) -{ -schedule (); -return 0 ; -} -static void wait_while_offlining (void ) {while (ksm_run &KSM_RUN_OFFLINE ) {mutex_unlock (&ksm_thread_mutex);wait_on_bit (&ksm_run,ilog2 (KSM_RUN_OFFLINE ), - just_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );mutex_lock (&ksm_thread_mutex); } }
net/bluetooth/hci_core.c +1 -7
@@ -2127,12 +2127,6 @@ static void hci_inq_req(struct hci_request *req, unsigned long opt)hci_req_add (req,HCI_OP_INQUIRY ,sizeof (cp), &cp); } -static int wait_inquiry (void *word) -{ -schedule (); -return signal_pending (current); -} -int hci_inquiry (void __user *arg) {__u8 __user *ptr = arg;
@@ -2183,7 +2177,7 @@ int hci_inquiry(void __user *arg)/* Wait until Inquiry procedure finishes (HCI_INQUIRY flag is * cleared). If it is interrupted by a signal, return -EINTR. */ -if (wait_on_bit (&hdev->flags,HCI_INQUIRY , wait_inquiry, +if (wait_on_bit (&hdev->flags,HCI_INQUIRY ,TASK_INTERRUPTIBLE ))return -EINTR ; }
security/keys/gc.c +1 -10
@@ -92,15 +92,6 @@ static void key_gc_timer_func(unsigned long data) }/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_gc_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* * Reap keys of dead type. * * We use three flags to make sure we see three complete cycles of the garbage
@@ -123,7 +114,7 @@ void key_gc_keytype(struct key_type *ktype)schedule_work (&key_gc_work);kdebug ("sleep" ); -wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE , key_gc_wait_bit, +wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE ,TASK_UNINTERRUPTIBLE ); key_gc_dead_keytype =NULL ;
security/keys/request_key.c +2 -21
@@ -21,24 +21,6 @@#define key_negative_timeout 60/* default timeout on a negative key's existence */ -/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -static int key_wait_bit_intr (void *flags) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/** * complete_request_key - Complete the construction of a key. * @cons: The key construction record.
@@ -592,10 +574,9 @@ int wait_for_key_construction(struct key *key, bool intr)int ret; ret =wait_on_bit (&key->flags,KEY_FLAG_USER_CONSTRUCT , - intr ? key_wait_bit_intr : key_wait_bit, intr ?TASK_INTERRUPTIBLE :TASK_UNINTERRUPTIBLE ); -if (ret <0 ) -return ret; +if (ret) +return -ERESTARTSYS ;if (test_bit (KEY_FLAG_NEGATIVE , &key->flags)) {smp_rmb ();return key->type_data.reject_error;
Peter Zijlstra
maintainerinclude/linux/wait.h int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); · line 885
Quoted 9 lines · NeilBrown
include/linux/wait.h +9
-0+static inline int +wait_on_bit (void *word,int bit,unsigned mode) +{ +if (!test_bit (bit, word)) +return 0 ; +return out_of_line_wait_on_bit (word, bit, + bit_wait, + mode &65535 ); +}
Still puzzled by the 16 bit mask there ;-)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 12 lines · On Thu, 1 May 2014 09:42:57 +0200 Peter Zijlstra <[email protected]> wrote:
Review
Quoted 9 lines · NeilBrown
(quoted diff) +9
-0+static inline int +wait_on_bit(void *word, int bit, unsigned mode) +{ + if (!test_bit(bit, word)) + return 0; + return out_of_line_wait_on_bit(word, bit, + bit_wait, + mode & 65535); +}Still puzzled by the 16 bit mask there ;-)
I clearly remember removing that!
And I've just done it again.
I hope it doesn't re-reappear!
:-)
NeilBrown
From: NeilBrown <[email protected]>
Subject: [PATCH] SCHED: remove proliferation of wait_on_bit action functions.
The current "wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which uses io_schedule() and one which just uses schedule().
So:
Rename wait_on_bit and wait_on_bit_lock to
wait_on_bit_action and wait_on_bit_lock_action
to make it explicit that they need an action function.
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
All instances of the old wait_on_bit and wait_on_bit_lock which can use the new version have been changed accordingly and their action functions have been discarded. wait_on_bit{_lock} does not return any specific error code in the event of a signal so the caller must check for non-zero and interpolate their own error code as appropriate.
The wait_on_bit() call in __fscache_wait_on_invalidate() was ambiguous as it specified TASK_UNINTERRUPTIBLE but used fscache_wait_bit_interruptible as an action function.
As any error return is never checked I assumed that 'uninterruptible' was correct.
The main remaining user of wait_on_bit{,_lock}_action is NFS which needs to use a freezer-aware schedule() call.
A comment in fs/gfs2/glock.c notes that having multiple 'action' functions is useful as they display differently in the 'wchan' field of 'ps'. (and /proc/$PID/wchan).
As the new bit_wait{,_io} functions are tagged "__sched", they will not show up at all, but something higher in the stack. So the distinction will still be visible, only with different function names (gds2_glock_wait versus gfs2_glock_dq_wait in the gfs2/glock.c case).
Documentation/filesystems/caching/operations.txt +1 -1
@@ -90,7 +90,7 @@ operations: to be cleared before proceeding: wait_on_bit(&op->flags, FSCACHE_OP_WAITING, - fscache_wait_bit, TASK_UNINTERRUPTIBLE); + TASK_UNINTERRUPTIBLE); (2) The operation may be fast asynchronous (FSCACHE_OP_FAST), in which case it
drivers/md/dm-bufio.c +15 -27
93 lines not on this page · raw message
drivers/md/dm-snap.c +1 -8
@@ -1032,20 +1032,13 @@ static void start_merge(struct dm_snapshot *s)snapshot_merge_next_chunks (s); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -/* * Stop the merging process and wait until it finishes. */ static void stop_merge (struct dm_snapshot *s) {set_bit (SHUTDOWN_MERGE , &s->state_bits); -wait_on_bit (&s->state_bits,RUNNING_MERGE , wait_schedule, +wait_on_bit (&s->state_bits,RUNNING_MERGE ,TASK_UNINTERRUPTIBLE );clear_bit (SHUTDOWN_MERGE , &s->state_bits); }
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +2 -9
@@ -253,13 +253,6 @@ static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)return usb_urb_exitv2 (&adap->stream); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -static int dvb_usb_start_feed (struct dvb_demux_feed *dvbdmxfeed) {struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
@@ -273,7 +266,7 @@ static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) dvbdmxfeed->pid, dvbdmxfeed->index);/* wait init is done */ -wait_on_bit (&adap->state_bits,ADAP_INIT , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_INIT ,TASK_UNINTERRUPTIBLE );if (adap->active_fe ==-1 )
@@ -568,7 +561,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)if (!adap->suspend_resume_active) {set_bit (ADAP_SLEEP , &adap->state_bits); -wait_on_bit (&adap->state_bits,ADAP_STREAMING , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_STREAMING ,TASK_UNINTERRUPTIBLE ); }
fs/btrfs/extent_io.c +2 -8
@@ -3373,16 +3373,10 @@ done_unlocked:return 0 ; } -static int eb_wait (void *word) -{ -io_schedule (); -return 0 ; -} -void wait_on_extent_buffer_writeback (struct extent_buffer *eb) { -wait_on_bit (&eb->bflags,EXTENT_BUFFER_WRITEBACK , eb_wait, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&eb->bflags,EXTENT_BUFFER_WRITEBACK , +TASK_UNINTERRUPTIBLE ); } static int lock_extent_buffer_for_io(struct extent_buffer *eb,
fs/buffer.c +2 -9
@@ -61,16 +61,9 @@ inline void touch_buffer(struct buffer_head *bh) }EXPORT_SYMBOL (touch_buffer); -static int sleep_on_buffer (void *word) -{ -io_schedule (); -return 0 ; -} -void __lock_buffer (struct buffer_head *bh) { -wait_on_bit_lock (&bh->b_state, BH_Lock, sleep_on_buffer, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_lock_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_buffer);
@@ -123,7 +116,7 @@ EXPORT_SYMBOL(buffer_check_dirty_writeback);*/ void __wait_on_buffer (struct buffer_head * bh) { -wait_on_bit (&bh->b_state, BH_Lock, sleep_on_buffer,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__wait_on_buffer);
fs/cifs/connect.c +1 -9
@@ -3931,13 +3931,6 @@ cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)return tlink_tcon (cifs_sb_master_tlink (cifs_sb)); } -static int -cifs_sb_tcon_pending_wait (void *unused) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/* find and return a tlink with given uid */ static struct tcon_link *tlink_rb_search (struct rb_root *root,kuid_t uid)
@@ -4036,11 +4029,10 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb) }else { wait_for_construction: ret =wait_on_bit (&tlink->tl_flags,TCON_LINK_PENDING , - cifs_sb_tcon_pending_wait,TASK_INTERRUPTIBLE );if (ret) {cifs_put_tlink (tlink); -return ERR_PTR (ret); +return ERR_PTR (-ERESTARTSYS ); }/* if it's good, return it */
fs/fs-writeback.c +2 -1
@@ -342,7 +342,8 @@ static void __inode_wait_for_writeback(struct inode *inode) wqh =bit_waitqueue (&inode->i_state, __I_SYNC);while (inode->i_state &I_SYNC ) {spin_unlock (&inode->i_lock); -__wait_on_bit (wqh, &wq, inode_wait,TASK_UNINTERRUPTIBLE ); +__wait_on_bit (wqh, &wq, bit_wait, +TASK_UNINTERRUPTIBLE );spin_lock (&inode->i_lock); } }
fs/fscache/cookie.c +3 -4
@@ -160,7 +160,7 @@ void __fscache_enable_cookie(struct fscache_cookie *cookie,_enter ("%p" , cookie);wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (test_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock;
@@ -255,7 +255,7 @@ static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie)if (!fscache_defer_lookup) {_debug ("non-deferred lookup %p" , &cookie->flags);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );_debug ("complete" );if (test_bit (FSCACHE_COOKIE_UNAVAILABLE , &cookie->flags)) goto unavailable;
@@ -463,7 +463,6 @@ void __fscache_wait_on_invalidate(struct fscache_cookie *cookie)_enter ("%p" , cookie);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_INVALIDATING , - fscache_wait_bit_interruptible,TASK_UNINTERRUPTIBLE );_leave ("" );
@@ -525,7 +524,7 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) }wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (!test_and_clear_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock_enable;
fs/fscache/internal.h +0 -2
@@ -91,8 +91,6 @@ static inline bool fscache_object_congested(void)return workqueue_congested (WORK_CPU_UNBOUND , fscache_object_wq); } -extern int fscache_wait_bit (void *); -extern int fscache_wait_bit_interruptible (void *);extern int fscache_wait_atomic_t (atomic_t *);/*
fs/fscache/main.c +0 -18
@@ -198,24 +198,6 @@ static void __exit fscache_exit(void)module_exit (fscache_exit);/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -int fscache_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -int fscache_wait_bit_interruptible (void *flags) -{ -schedule (); -return signal_pending (current); -} - -/* * wait_on_atomic_t() sleep function for uninterruptible waiting */ int fscache_wait_atomic_t (atomic_t *p)
fs/fscache/page.c +1 -3
@@ -298,7 +298,6 @@ int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie) jif = jiffies;if (wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) {fscache_stat (&fscache_n_retrievals_intr);_leave (" = -ERESTARTSYS" );
@@ -342,7 +341,6 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,if (stat_op_waits)fscache_stat (stat_op_waits);if (wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) { ret =fscache_cancel_op (op, do_cancel);if (ret ==0 )
@@ -351,7 +349,7 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,/* it's been removed from the pending queue by another party, * so we should get to run shortly */ wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); }_debug ("<<< GO" );
fs/gfs2/glock.c +2 -23
@@ -856,27 +856,6 @@ void gfs2_holder_uninit(struct gfs2_holder *gh) }/** -* gfs2_glock_holder_wait -* @word: unused -* -* This function and gfs2_glock_demote_wait both show up in the WCHAN -* field. Thus I've separated these otherwise identical functions in -* order to be more informative to the user. -*/ - -static int gfs2_glock_holder_wait (void *word) -{ -schedule (); -return 0 ; -} - -static int gfs2_glock_demote_wait (void *word) -{ -schedule (); -return 0 ; -} - -/** * gfs2_glock_wait - wait on a glock acquisition * @gh: the glock holder *
@@ -888,7 +867,7 @@ int gfs2_glock_wait(struct gfs2_holder *gh)unsigned long time1 = jiffies;might_sleep (); -wait_on_bit (&gh->gh_iflags,HIF_WAIT , gfs2_glock_holder_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gh->gh_iflags,HIF_WAIT ,TASK_UNINTERRUPTIBLE );if (time_after (jiffies, time1 +HZ ))/* have we waited > a second? */ /* Lengthen the minimum hold time. */ gh->gh_gl->gl_hold_time = min(gh->gh_gl->gl_hold_time +
@@ -1128,7 +1107,7 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh)struct gfs2_glock *gl = gh->gh_gl;gfs2_glock_dq (gh);might_sleep (); -wait_on_bit (&gl->gl_flags,GLF_DEMOTE , gfs2_glock_demote_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gl->gl_flags,GLF_DEMOTE ,TASK_UNINTERRUPTIBLE ); }/**
fs/gfs2/lock_dlm.c +1 -7
@@ -936,12 +936,6 @@ fail:return error; } -static int dlm_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -static int control_first_done (struct gfs2_sbd *sdp) {struct lm_lockstruct *ls = &sdp->sd_lockstruct;
@@ -976,7 +970,7 @@ restart:fs_info (sdp,"control_first_done wait gen %u\n" , start_gen);wait_on_bit (&ls->ls_recover_flags,DFL_DLM_RECOVERY , - dlm_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }
fs/gfs2/ops_fstype.c +2 -9
@@ -1010,20 +1010,13 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp) lm->lm_unmount (sdp); } -static int gfs2_journalid_wait (void *word) -{ -if (signal_pending (current)) -return -EINTR ; -schedule (); -return 0 ; -} -static int wait_on_journal (struct gfs2_sbd *sdp) {if (sdp->sd_lockstruct.ls_ops->lm_mount ==NULL )return 0 ; -return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID , gfs2_journalid_wait,TASK_INTERRUPTIBLE ); +return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID ,TASK_INTERRUPTIBLE ) + ? -EINTR :0 ; }void gfs2_online_uevent (struct gfs2_sbd *sdp)
fs/gfs2/recovery.c +1 -7
@@ -591,12 +591,6 @@ done:wake_up_bit (&jd->jd_flags,JDF_RECOVERY ); } -static int gfs2_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -int gfs2_recover_journal (struct gfs2_jdesc *jd,bool wait) {int rv;
@@ -609,7 +603,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)BUG_ON (!rv);if (wait) -wait_on_bit (&jd->jd_flags,JDF_RECOVERY , gfs2_recovery_wait, +wait_on_bit (&jd->jd_flags,JDF_RECOVERY ,TASK_UNINTERRUPTIBLE );return wait ? jd->jd_recover_error :0 ;
fs/gfs2/super.c +1 -7
@@ -850,12 +850,6 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)return error; } -static int gfs2_umount_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -/** * gfs2_put_super - Unmount the filesystem * @sb: The VFS superblock
@@ -880,7 +874,7 @@ restart:continue ;spin_unlock (&sdp->sd_jindex_spin);wait_on_bit (&jd->jd_flags,JDF_RECOVERY , - gfs2_umount_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }spin_unlock (&sdp->sd_jindex_spin);
fs/inode.c +0 -7
@@ -1695,13 +1695,6 @@ int inode_needs_sync(struct inode *inode) }EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) -{ -schedule (); -return 0 ; -} -EXPORT_SYMBOL (inode_wait); -/* * If we try to find an inode in the inode hash while it is being * deleted, we have to wait until the filesystem completes its
fs/jbd2/transaction.c +2 -8
@@ -763,12 +763,6 @@ static void warn_dirty_buffer(struct buffer_head *bh) bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr); } -static int sleep_on_shadow_bh (void *word) -{ -io_schedule (); -return 0 ; -} -/* * If the buffer is already part of the current transaction, then there * is nothing we need to do. If it is already part of a prior
@@ -906,8 +900,8 @@ repeat:if (buffer_shadow (bh)) {JBUFFER_TRACE (jh,"on shadow: sleep" );jbd_unlock_bh_state (bh); -wait_on_bit (&bh->b_state, BH_Shadow, - sleep_on_shadow_bh,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Shadow, +TASK_UNINTERRUPTIBLE ); goto repeat; }
fs/nfs/file.c +2 -2
@@ -362,8 +362,8 @@ start:* Prevent starvation issues if someone is doing a consistency * sync-to-disk */ - ret =wait_on_bit (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret)return ret;
fs/nfs/inode.c +2 -2
@@ -1061,8 +1061,8 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)* the bit lock here if it looks like we're going to be doing that. */ for (;;) { - ret =wait_on_bit (bitlock,NFS_INO_INVALIDATING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (bitlock,NFS_INO_INVALIDATING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret) goto out;spin_lock (&inode->i_lock);
fs/nfs/nfs4filelayoutdev.c +2 -2
@@ -783,8 +783,8 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j)static void nfs4_wait_ds_connect (struct nfs4_pnfs_ds *ds) {might_sleep (); -wait_on_bit (&ds->ds_state,NFS4DS_CONNECTING , - nfs_wait_bit_killable,TASK_KILLABLE ); +wait_on_bit_action (&ds->ds_state,NFS4DS_CONNECTING , + nfs_wait_bit_killable,TASK_KILLABLE ); }static void nfs4_clear_ds_conn_bit (struct nfs4_pnfs_ds *ds)
fs/nfs/nfs4state.c +2 -2
@@ -1251,8 +1251,8 @@ int nfs4_wait_clnt_recover(struct nfs_client *clp)might_sleep ();atomic_inc (&clp->cl_count); - res =wait_on_bit (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , - nfs_wait_bit_killable,TASK_KILLABLE ); + res =wait_on_bit_action (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , + nfs_wait_bit_killable,TASK_KILLABLE );if (res) goto out;if (clp->cl_cons_state <0 )
fs/nfs/pagelist.c +2 -9
@@ -258,12 +258,6 @@ void nfs_release_request(struct nfs_page *req)kref_put (&req->wb_kref, nfs_free_request); } -static int nfs_wait_bit_uninterruptible (void *word) -{ -io_schedule (); -return 0 ; -} -/** * nfs_wait_on_request - Wait for a request to complete. * @req: request to wait upon.
@@ -274,9 +268,8 @@ static int nfs_wait_bit_uninterruptible(void *word)int nfs_wait_on_request (struct nfs_page *req) { -return wait_on_bit (&req->wb_flags,PG_BUSY , - nfs_wait_bit_uninterruptible, -TASK_UNINTERRUPTIBLE ); +return wait_on_bit_io (&req->wb_flags,PG_BUSY , +TASK_UNINTERRUPTIBLE ); }bool nfs_generic_pg_test (struct nfs_pageio_descriptor *desc,struct nfs_page *prev,struct nfs_page *req)
fs/nfs/pnfs.c +1 -1
@@ -1913,7 +1913,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)if (test_and_set_bit (NFS_INO_LAYOUTCOMMITTING , &nfsi->flags)) {if (!sync) goto out; - status =wait_on_bit_lock (&nfsi->flags, + status =wait_on_bit_lock_action (&nfsi->flags,NFS_INO_LAYOUTCOMMITTING , nfs_wait_bit_killable,TASK_KILLABLE );
fs/nfs/write.c +2 -2
@@ -393,7 +393,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)int err;/* Stop dirtying of new pages while we sync */ - err =wait_on_bit_lock (bitlock,NFS_INO_FLUSHING , + err =wait_on_bit_lock_action (bitlock,NFS_INO_FLUSHING , nfs_wait_bit_killable,TASK_KILLABLE );if (err) goto out_err;
@@ -1694,7 +1694,7 @@ int nfs_commit_inode(struct inode *inode, int how)return error;if (!may_wait) goto out_mark_dirty; - error =wait_on_bit (&NFS_I (inode)->flags, + error =wait_on_bit_action (&NFS_I (inode)->flags,NFS_INO_COMMIT , nfs_wait_bit_killable,TASK_KILLABLE );
include/linux/wait.h +111 -4
147 lines not on this page · raw message
include/linux/writeback.h +1 -2
@@ -90,7 +90,6 @@ struct writeback_control {* fs/fs-writeback.c */ struct bdi_writeback ; -int inode_wait (void *);void writeback_inodes_sb (struct super_block *,enum wb_reason reason);void writeback_inodes_sb_nr (struct super_block *,unsigned long nr,enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);static inline void wait_on_inode (struct inode *inode) {might_sleep (); -wait_on_bit (&inode->i_state, __I_NEW, inode_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&inode->i_state, __I_NEW,TASK_UNINTERRUPTIBLE ); }/*
kernel/ptrace.c +1 -7
@@ -28,12 +28,6 @@#include <linux/compat.h> -static int ptrace_trapping_sleep_fn (void *flags) -{ -schedule (); -return 0 ; -} -/* * ptrace a task: make the debugger its new parent and * move it to the ptrace list.
@@ -371,7 +365,7 @@ unlock_creds: out:if (!retval) {wait_on_bit (&task->jobctl,JOBCTL_TRAPPING_BIT , - ptrace_trapping_sleep_fn,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );proc_ptrace_connector (task,PTRACE_ATTACH ); }
kernel/sched/wait.c +18 -0
@@ -502,3 +502,21 @@ void wake_up_atomic_t(atomic_t *p)__wake_up_bit (atomic_t_waitqueue (p), p,WAIT_ATOMIC_T_BIT_NR ); }EXPORT_SYMBOL (wake_up_atomic_t); + +__sched int bit_wait(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait); + +__sched int bit_wait_io(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +io_schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait_io);
mm/filemap.c +4 -16
@@ -241,18 +241,6 @@ void delete_from_page_cache(struct page *page) }EXPORT_SYMBOL (delete_from_page_cache); -static int sleep_on_page (void *word) -{ -io_schedule (); -return 0 ; -} - -static int sleep_on_page_killable (void *word) -{ -sleep_on_page (word); -return fatal_signal_pending (current) ? -EINTR :0 ; -} -static int filemap_check_errors (struct address_space *mapping) {int ret =0 ;
@@ -690,7 +678,7 @@ void wait_on_page_bit(struct page *page, int bit_nr)DEFINE_WAIT_BIT (wait, &page->flags, bit_nr);if (test_bit (bit_nr, &page->flags)) -__wait_on_bit (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (wait_on_page_bit);
@@ -703,7 +691,7 @@ int wait_on_page_bit_killable(struct page *page, int bit_nr)return 0 ;return __wait_on_bit (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }/**
@@ -770,7 +758,7 @@ void __lock_page(struct page *page) {DEFINE_WAIT_BIT (wait, &page->flags, PG_locked); -__wait_on_bit_lock (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit_lock (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_page);
@@ -780,7 +768,7 @@ int __lock_page_killable(struct page *page)DEFINE_WAIT_BIT (wait, &page->flags, PG_locked);return __wait_on_bit_lock (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }EXPORT_SYMBOL_GPL (__lock_page_killable);
mm/ksm.c +1 -7
@@ -1979,18 +1979,12 @@ void ksm_migrate_page(struct page *newpage, struct page *oldpage)#endif /* CONFIG_MIGRATION */ #ifdef CONFIG_MEMORY_HOTREMOVE -static int just_wait (void *word) -{ -schedule (); -return 0 ; -} -static void wait_while_offlining (void ) {while (ksm_run &KSM_RUN_OFFLINE ) {mutex_unlock (&ksm_thread_mutex);wait_on_bit (&ksm_run,ilog2 (KSM_RUN_OFFLINE ), - just_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );mutex_lock (&ksm_thread_mutex); } }
net/bluetooth/hci_core.c +1 -7
@@ -2127,12 +2127,6 @@ static void hci_inq_req(struct hci_request *req, unsigned long opt)hci_req_add (req,HCI_OP_INQUIRY ,sizeof (cp), &cp); } -static int wait_inquiry (void *word) -{ -schedule (); -return signal_pending (current); -} -int hci_inquiry (void __user *arg) {__u8 __user *ptr = arg;
@@ -2183,7 +2177,7 @@ int hci_inquiry(void __user *arg)/* Wait until Inquiry procedure finishes (HCI_INQUIRY flag is * cleared). If it is interrupted by a signal, return -EINTR. */ -if (wait_on_bit (&hdev->flags,HCI_INQUIRY , wait_inquiry, +if (wait_on_bit (&hdev->flags,HCI_INQUIRY ,TASK_INTERRUPTIBLE ))return -EINTR ; }
security/keys/gc.c +1 -10
@@ -92,15 +92,6 @@ static void key_gc_timer_func(unsigned long data) }/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_gc_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* * Reap keys of dead type. * * We use three flags to make sure we see three complete cycles of the garbage
@@ -123,7 +114,7 @@ void key_gc_keytype(struct key_type *ktype)schedule_work (&key_gc_work);kdebug ("sleep" ); -wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE , key_gc_wait_bit, +wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE ,TASK_UNINTERRUPTIBLE ); key_gc_dead_keytype =NULL ;
security/keys/request_key.c +2 -21
@@ -21,24 +21,6 @@#define key_negative_timeout 60/* default timeout on a negative key's existence */ -/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -static int key_wait_bit_intr (void *flags) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/** * complete_request_key - Complete the construction of a key. * @cons: The key construction record.
@@ -592,10 +574,9 @@ int wait_for_key_construction(struct key *key, bool intr)int ret; ret =wait_on_bit (&key->flags,KEY_FLAG_USER_CONSTRUCT , - intr ? key_wait_bit_intr : key_wait_bit, intr ?TASK_INTERRUPTIBLE :TASK_UNINTERRUPTIBLE ); -if (ret <0 ) -return ret; +if (ret) +return -ERESTARTSYS ;if (test_bit (KEY_FLAG_NEGATIVE , &key->flags)) {smp_rmb ();return key->type_data.reject_error;
Peter Zijlstra
maintainerQuoted 15 lines · NeilBrown
Quoted 12 lines · On Thu, 1 May 2014 09:42:57 +0200 Peter Zijlstra <[email protected]> wrote:
include/linux/wait.h int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); · line 885
Quoted 9 lines · NeilBrown
include/linux/wait.h +9
-0+static inline int +wait_on_bit (void *word,int bit,unsigned mode) +{ +if (!test_bit (bit, word)) +return 0 ; +return out_of_line_wait_on_bit (word, bit, + bit_wait, + mode &65535 ); +}Still puzzled by the 16 bit mask there ;-)
Quoted 5 lines
I clearly remember removing that!
And I've just done it again.
I hope it doesn't re-reappear!
:-)
NeilBrown
Seems dead now, I'll hold out for a little while so that dhowells can explain this fscache thing.
Then I'll queue it. Ingo is currently enjoying a long weekend and is fighting (well I am now) a stability issue in -tip kernels, so it might be a little while before it actually shows up in the git tree.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
David Howells
maintainerQuoted 5 lines · NeilBrown
The
wait_on_bit()call in__fscache_wait_on_invalidate()was ambiguous as it specifiedTASK_UNINTERRUPTIBLEbut usedfscache_wait_bit_interruptibleas an action function.
As any error return is never checked I assumed that 'uninterruptible' was correct.
Bug. It should be uninterruptible in both places.
David
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Peter Zijlstra
maintainerQuoted 9 lines · David Howells
Quoted 5 lines · NeilBrown
The
wait_on_bit()call in__fscache_wait_on_invalidate()was ambiguous as it specifiedTASK_UNINTERRUPTIBLEbut usedfscache_wait_bit_interruptibleas an action function.
As any error return is never checked I assumed that 'uninterruptible' was correct.Bug. It should be uninterruptible in both places.
Thanks David, queued the patch!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · NeilBrown
The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.
Quoted 6 lines
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
Yay! About time! This is something I've wanted to do for ages, but never quite got around to.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for NeilBrown
merge bot[tip:sched/core] sched: Remove proliferation of wait_on_bit action functions.
In reply to NeilBrownsched: Remove proliferation of wait_on_bit action functions.
Commit-ID: 481df27d1341b6c68ea80a2e1ed619a6af0c95f0 Gitweb: http://git.kernel.org/tip/481df27d1341b6c68ea80a2e1ed619a6af0c95f0 Author: NeilBrown <[email protected]> AuthorDate: Thu, 1 May 2014 12:37:38 +1000 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 19 May 2014 22:02:40 +0900
sched: Remove proliferation of wait_on_bit action functions.
The current "wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which uses io_schedule() and one which just uses schedule().
So:
Rename wait_on_bit and wait_on_bit_lock to
wait_on_bit_action and wait_on_bit_lock_action
to make it explicit that they need an action function.
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
All instances of the old wait_on_bit and wait_on_bit_lock which can use the new version have been changed accordingly and their action functions have been discarded. wait_on_bit{_lock} does not return any specific error code in the event of a signal so the caller must check for non-zero and interpolate their own error code as appropriate.
The wait_on_bit() call in __fscache_wait_on_invalidate() was ambiguous as it specified TASK_UNINTERRUPTIBLE but used fscache_wait_bit_interruptible as an action function.
As any error return is never checked I assumed that 'uninterruptible' was correct.
The main remaining user of wait_on_bit{,_lock}_action is NFS which needs to use a freezer-aware schedule() call.
A comment in fs/gfs2/glock.c notes that having multiple 'action' functions is useful as they display differently in the 'wchan' field of 'ps'. (and /proc/$PID/wchan).
As the new bit_wait{,_io} functions are tagged "__sched", they will not show up at all, but something higher in the stack. So the distinction will still be visible, only with different function names (gds2_glock_wait versus gfs2_glock_dq_wait in the gfs2/glock.c case).
--- Documentation/filesystems/caching/operations.txt | 2 +- drivers/md/dm-bufio.c | 42 +++------ drivers/md/dm-snap.c | 9 +- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 11 +-- fs/btrfs/extent_io.c | 10 +- fs/buffer.c | 11 +-- fs/cifs/connect.c | 10 +- fs/fs-writeback.c | 3 +- fs/fscache/cookie.c | 7 +- fs/fscache/internal.h | 2 - fs/fscache/main.c | 18 ---- fs/fscache/page.c | 4 +- fs/gfs2/glock.c | 25 +---- fs/gfs2/lock_dlm.c | 8 +- fs/gfs2/ops_fstype.c | 11 +-- fs/gfs2/recovery.c | 8 +- fs/gfs2/super.c | 8 +- fs/inode.c | 7 -- fs/jbd2/transaction.c | 10 +- fs/nfs/file.c | 4 +- fs/nfs/inode.c | 4 +- fs/nfs/nfs4filelayoutdev.c | 4 +- fs/nfs/nfs4state.c | 4 +- fs/nfs/pagelist.c | 11 +-- fs/nfs/pnfs.c | 2 +- fs/nfs/write.c | 4 +- include/linux/wait.h | 115 ++++++++++++++++++++++- include/linux/writeback.h | 3 +- kernel/ptrace.c | 8 +- kernel/sched/wait.c | 18 ++++ mm/filemap.c | 20 +--- mm/ksm.c | 8 +- net/bluetooth/hci_core.c | 8 +- security/keys/gc.c | 11 +-- security/keys/request_key.c | 23 +---- 35 files changed, 192 insertions(+), 261 deletions(-)
Documentation/filesystems/caching/operations.txt +1 -1
@@ -90,7 +90,7 @@ operations: to be cleared before proceeding: wait_on_bit(&op->flags, FSCACHE_OP_WAITING, - fscache_wait_bit, TASK_UNINTERRUPTIBLE); + TASK_UNINTERRUPTIBLE); (2) The operation may be fast asynchronous (FSCACHE_OP_FAST), in which case it
drivers/md/dm-bufio.c +15 -27
93 lines not on this page · raw message
drivers/md/dm-snap.c +1 -8
@@ -1032,20 +1032,13 @@ static void start_merge(struct dm_snapshot *s)snapshot_merge_next_chunks (s); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -/* * Stop the merging process and wait until it finishes. */ static void stop_merge (struct dm_snapshot *s) {set_bit (SHUTDOWN_MERGE , &s->state_bits); -wait_on_bit (&s->state_bits,RUNNING_MERGE , wait_schedule, +wait_on_bit (&s->state_bits,RUNNING_MERGE ,TASK_UNINTERRUPTIBLE );clear_bit (SHUTDOWN_MERGE , &s->state_bits); }
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +2 -9
@@ -253,13 +253,6 @@ static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)return usb_urb_exitv2 (&adap->stream); } -static int wait_schedule (void *ptr) -{ -schedule (); - -return 0 ; -} -static int dvb_usb_start_feed (struct dvb_demux_feed *dvbdmxfeed) {struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
@@ -273,7 +266,7 @@ static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) dvbdmxfeed->pid, dvbdmxfeed->index);/* wait init is done */ -wait_on_bit (&adap->state_bits,ADAP_INIT , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_INIT ,TASK_UNINTERRUPTIBLE );if (adap->active_fe ==-1 )
@@ -568,7 +561,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)if (!adap->suspend_resume_active) {set_bit (ADAP_SLEEP , &adap->state_bits); -wait_on_bit (&adap->state_bits,ADAP_STREAMING , wait_schedule, +wait_on_bit (&adap->state_bits,ADAP_STREAMING ,TASK_UNINTERRUPTIBLE ); }
fs/btrfs/extent_io.c +2 -8
@@ -3373,16 +3373,10 @@ done_unlocked:return 0 ; } -static int eb_wait (void *word) -{ -io_schedule (); -return 0 ; -} -void wait_on_extent_buffer_writeback (struct extent_buffer *eb) { -wait_on_bit (&eb->bflags,EXTENT_BUFFER_WRITEBACK , eb_wait, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&eb->bflags,EXTENT_BUFFER_WRITEBACK , +TASK_UNINTERRUPTIBLE ); } static int lock_extent_buffer_for_io(struct extent_buffer *eb,
fs/buffer.c +2 -9
@@ -61,16 +61,9 @@ inline void touch_buffer(struct buffer_head *bh) }EXPORT_SYMBOL (touch_buffer); -static int sleep_on_buffer (void *word) -{ -io_schedule (); -return 0 ; -} -void __lock_buffer (struct buffer_head *bh) { -wait_on_bit_lock (&bh->b_state, BH_Lock, sleep_on_buffer, -TASK_UNINTERRUPTIBLE ); +wait_on_bit_lock_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_buffer);
@@ -123,7 +116,7 @@ EXPORT_SYMBOL(buffer_check_dirty_writeback);*/ void __wait_on_buffer (struct buffer_head * bh) { -wait_on_bit (&bh->b_state, BH_Lock, sleep_on_buffer,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Lock,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__wait_on_buffer);
fs/cifs/connect.c +1 -9
@@ -3931,13 +3931,6 @@ cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)return tlink_tcon (cifs_sb_master_tlink (cifs_sb)); } -static int -cifs_sb_tcon_pending_wait (void *unused) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/* find and return a tlink with given uid */ static struct tcon_link *tlink_rb_search (struct rb_root *root,kuid_t uid)
@@ -4036,11 +4029,10 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb) }else { wait_for_construction: ret =wait_on_bit (&tlink->tl_flags,TCON_LINK_PENDING , - cifs_sb_tcon_pending_wait,TASK_INTERRUPTIBLE );if (ret) {cifs_put_tlink (tlink); -return ERR_PTR (ret); +return ERR_PTR (-ERESTARTSYS ); }/* if it's good, return it */
fs/fs-writeback.c +2 -1
@@ -342,7 +342,8 @@ static void __inode_wait_for_writeback(struct inode *inode) wqh =bit_waitqueue (&inode->i_state, __I_SYNC);while (inode->i_state &I_SYNC ) {spin_unlock (&inode->i_lock); -__wait_on_bit (wqh, &wq, inode_wait,TASK_UNINTERRUPTIBLE ); +__wait_on_bit (wqh, &wq, bit_wait, +TASK_UNINTERRUPTIBLE );spin_lock (&inode->i_lock); } }
fs/fscache/cookie.c +3 -4
@@ -160,7 +160,7 @@ void __fscache_enable_cookie(struct fscache_cookie *cookie,_enter ("%p" , cookie);wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (test_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock;
@@ -255,7 +255,7 @@ static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie)if (!fscache_defer_lookup) {_debug ("non-deferred lookup %p" , &cookie->flags);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );_debug ("complete" );if (test_bit (FSCACHE_COOKIE_UNAVAILABLE , &cookie->flags)) goto unavailable;
@@ -463,7 +463,6 @@ void __fscache_wait_on_invalidate(struct fscache_cookie *cookie)_enter ("%p" , cookie);wait_on_bit (&cookie->flags,FSCACHE_COOKIE_INVALIDATING , - fscache_wait_bit_interruptible,TASK_UNINTERRUPTIBLE );_leave ("" );
@@ -525,7 +524,7 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) }wait_on_bit_lock (&cookie->flags,FSCACHE_COOKIE_ENABLEMENT_LOCK , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );if (!test_and_clear_bit (FSCACHE_COOKIE_ENABLED , &cookie->flags)) goto out_unlock_enable;
fs/fscache/internal.h +0 -2
@@ -91,8 +91,6 @@ static inline bool fscache_object_congested(void)return workqueue_congested (WORK_CPU_UNBOUND , fscache_object_wq); } -extern int fscache_wait_bit (void *); -extern int fscache_wait_bit_interruptible (void *);extern int fscache_wait_atomic_t (atomic_t *);/*
fs/fscache/main.c +0 -18
@@ -198,24 +198,6 @@ static void __exit fscache_exit(void)module_exit (fscache_exit);/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -int fscache_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -int fscache_wait_bit_interruptible (void *flags) -{ -schedule (); -return signal_pending (current); -} - -/* * wait_on_atomic_t() sleep function for uninterruptible waiting */ int fscache_wait_atomic_t (atomic_t *p)
fs/fscache/page.c +1 -3
@@ -298,7 +298,6 @@ int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie) jif = jiffies;if (wait_on_bit (&cookie->flags,FSCACHE_COOKIE_LOOKING_UP , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) {fscache_stat (&fscache_n_retrievals_intr);_leave (" = -ERESTARTSYS" );
@@ -342,7 +341,6 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,if (stat_op_waits)fscache_stat (stat_op_waits);if (wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit_interruptible,TASK_INTERRUPTIBLE ) !=0 ) { ret =fscache_cancel_op (op, do_cancel);if (ret ==0 )
@@ -351,7 +349,7 @@ int fscache_wait_for_operation_activation(struct fscache_object *object,/* it's been removed from the pending queue by another party, * so we should get to run shortly */ wait_on_bit (&op->flags,FSCACHE_OP_WAITING , - fscache_wait_bit,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); }_debug ("<<< GO" );
fs/gfs2/glock.c +2 -23
@@ -856,27 +856,6 @@ void gfs2_holder_uninit(struct gfs2_holder *gh) }/** -* gfs2_glock_holder_wait -* @word: unused -* -* This function and gfs2_glock_demote_wait both show up in the WCHAN -* field. Thus I've separated these otherwise identical functions in -* order to be more informative to the user. -*/ - -static int gfs2_glock_holder_wait (void *word) -{ -schedule (); -return 0 ; -} - -static int gfs2_glock_demote_wait (void *word) -{ -schedule (); -return 0 ; -} - -/** * gfs2_glock_wait - wait on a glock acquisition * @gh: the glock holder *
@@ -888,7 +867,7 @@ int gfs2_glock_wait(struct gfs2_holder *gh)unsigned long time1 = jiffies;might_sleep (); -wait_on_bit (&gh->gh_iflags,HIF_WAIT , gfs2_glock_holder_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gh->gh_iflags,HIF_WAIT ,TASK_UNINTERRUPTIBLE );if (time_after (jiffies, time1 +HZ ))/* have we waited > a second? */ /* Lengthen the minimum hold time. */ gh->gh_gl->gl_hold_time = min(gh->gh_gl->gl_hold_time +
@@ -1128,7 +1107,7 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh)struct gfs2_glock *gl = gh->gh_gl;gfs2_glock_dq (gh);might_sleep (); -wait_on_bit (&gl->gl_flags,GLF_DEMOTE , gfs2_glock_demote_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&gl->gl_flags,GLF_DEMOTE ,TASK_UNINTERRUPTIBLE ); }/**
fs/gfs2/lock_dlm.c +1 -7
@@ -936,12 +936,6 @@ fail:return error; } -static int dlm_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -static int control_first_done (struct gfs2_sbd *sdp) {struct lm_lockstruct *ls = &sdp->sd_lockstruct;
@@ -976,7 +970,7 @@ restart:fs_info (sdp,"control_first_done wait gen %u\n" , start_gen);wait_on_bit (&ls->ls_recover_flags,DFL_DLM_RECOVERY , - dlm_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }
fs/gfs2/ops_fstype.c +2 -9
@@ -1010,20 +1010,13 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp) lm->lm_unmount (sdp); } -static int gfs2_journalid_wait (void *word) -{ -if (signal_pending (current)) -return -EINTR ; -schedule (); -return 0 ; -} -static int wait_on_journal (struct gfs2_sbd *sdp) {if (sdp->sd_lockstruct.ls_ops->lm_mount ==NULL )return 0 ; -return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID , gfs2_journalid_wait,TASK_INTERRUPTIBLE ); +return wait_on_bit (&sdp->sd_flags,SDF_NOJOURNALID ,TASK_INTERRUPTIBLE ) + ? -EINTR :0 ; }void gfs2_online_uevent (struct gfs2_sbd *sdp)
fs/gfs2/recovery.c +1 -7
@@ -591,12 +591,6 @@ done:wake_up_bit (&jd->jd_flags,JDF_RECOVERY ); } -static int gfs2_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -int gfs2_recover_journal (struct gfs2_jdesc *jd,bool wait) {int rv;
@@ -609,7 +603,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)BUG_ON (!rv);if (wait) -wait_on_bit (&jd->jd_flags,JDF_RECOVERY , gfs2_recovery_wait, +wait_on_bit (&jd->jd_flags,JDF_RECOVERY ,TASK_UNINTERRUPTIBLE );return wait ? jd->jd_recover_error :0 ;
fs/gfs2/super.c +1 -7
@@ -850,12 +850,6 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)return error; } -static int gfs2_umount_recovery_wait (void *word) -{ -schedule (); -return 0 ; -} -/** * gfs2_put_super - Unmount the filesystem * @sb: The VFS superblock
@@ -880,7 +874,7 @@ restart:continue ;spin_unlock (&sdp->sd_jindex_spin);wait_on_bit (&jd->jd_flags,JDF_RECOVERY , - gfs2_umount_recovery_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE ); goto restart; }spin_unlock (&sdp->sd_jindex_spin);
fs/inode.c +0 -7
@@ -1695,13 +1695,6 @@ int inode_needs_sync(struct inode *inode) }EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) -{ -schedule (); -return 0 ; -} -EXPORT_SYMBOL (inode_wait); -/* * If we try to find an inode in the inode hash while it is being * deleted, we have to wait until the filesystem completes its
fs/jbd2/transaction.c +2 -8
@@ -763,12 +763,6 @@ static void warn_dirty_buffer(struct buffer_head *bh) bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr); } -static int sleep_on_shadow_bh (void *word) -{ -io_schedule (); -return 0 ; -} -/* * If the buffer is already part of the current transaction, then there * is nothing we need to do. If it is already part of a prior
@@ -906,8 +900,8 @@ repeat:if (buffer_shadow (bh)) {JBUFFER_TRACE (jh,"on shadow: sleep" );jbd_unlock_bh_state (bh); -wait_on_bit (&bh->b_state, BH_Shadow, - sleep_on_shadow_bh,TASK_UNINTERRUPTIBLE ); +wait_on_bit_io (&bh->b_state, BH_Shadow, +TASK_UNINTERRUPTIBLE ); goto repeat; }
fs/nfs/file.c +2 -2
@@ -362,8 +362,8 @@ start:* Prevent starvation issues if someone is doing a consistency * sync-to-disk */ - ret =wait_on_bit (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret)return ret;
fs/nfs/inode.c +2 -2
@@ -1061,8 +1061,8 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)* the bit lock here if it looks like we're going to be doing that. */ for (;;) { - ret =wait_on_bit (bitlock,NFS_INO_INVALIDATING , - nfs_wait_bit_killable,TASK_KILLABLE ); + ret =wait_on_bit_action (bitlock,NFS_INO_INVALIDATING , + nfs_wait_bit_killable,TASK_KILLABLE );if (ret) goto out;spin_lock (&inode->i_lock);
fs/nfs/nfs4filelayoutdev.c +2 -2
@@ -783,8 +783,8 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j)static void nfs4_wait_ds_connect (struct nfs4_pnfs_ds *ds) {might_sleep (); -wait_on_bit (&ds->ds_state,NFS4DS_CONNECTING , - nfs_wait_bit_killable,TASK_KILLABLE ); +wait_on_bit_action (&ds->ds_state,NFS4DS_CONNECTING , + nfs_wait_bit_killable,TASK_KILLABLE ); }static void nfs4_clear_ds_conn_bit (struct nfs4_pnfs_ds *ds)
fs/nfs/nfs4state.c +2 -2
@@ -1251,8 +1251,8 @@ int nfs4_wait_clnt_recover(struct nfs_client *clp)might_sleep ();atomic_inc (&clp->cl_count); - res =wait_on_bit (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , - nfs_wait_bit_killable,TASK_KILLABLE ); + res =wait_on_bit_action (&clp->cl_state,NFS4CLNT_MANAGER_RUNNING , + nfs_wait_bit_killable,TASK_KILLABLE );if (res) goto out;if (clp->cl_cons_state <0 )
fs/nfs/pagelist.c +2 -9
@@ -258,12 +258,6 @@ void nfs_release_request(struct nfs_page *req)kref_put (&req->wb_kref, nfs_free_request); } -static int nfs_wait_bit_uninterruptible (void *word) -{ -io_schedule (); -return 0 ; -} -/** * nfs_wait_on_request - Wait for a request to complete. * @req: request to wait upon.
@@ -274,9 +268,8 @@ static int nfs_wait_bit_uninterruptible(void *word)int nfs_wait_on_request (struct nfs_page *req) { -return wait_on_bit (&req->wb_flags,PG_BUSY , - nfs_wait_bit_uninterruptible, -TASK_UNINTERRUPTIBLE ); +return wait_on_bit_io (&req->wb_flags,PG_BUSY , +TASK_UNINTERRUPTIBLE ); }bool nfs_generic_pg_test (struct nfs_pageio_descriptor *desc,struct nfs_page *prev,struct nfs_page *req)
fs/nfs/pnfs.c +1 -1
@@ -1913,7 +1913,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)if (test_and_set_bit (NFS_INO_LAYOUTCOMMITTING , &nfsi->flags)) {if (!sync) goto out; - status =wait_on_bit_lock (&nfsi->flags, + status =wait_on_bit_lock_action (&nfsi->flags,NFS_INO_LAYOUTCOMMITTING , nfs_wait_bit_killable,TASK_KILLABLE );
fs/nfs/write.c +2 -2
@@ -393,7 +393,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)int err;/* Stop dirtying of new pages while we sync */ - err =wait_on_bit_lock (bitlock,NFS_INO_FLUSHING , + err =wait_on_bit_lock_action (bitlock,NFS_INO_FLUSHING , nfs_wait_bit_killable,TASK_KILLABLE );if (err) goto out_err;
@@ -1694,7 +1694,7 @@ int nfs_commit_inode(struct inode *inode, int how)return error;if (!may_wait) goto out_mark_dirty; - error =wait_on_bit (&NFS_I (inode)->flags, + error =wait_on_bit_action (&NFS_I (inode)->flags,NFS_INO_COMMIT , nfs_wait_bit_killable,TASK_KILLABLE );
include/linux/wait.h +111 -4
147 lines not on this page · raw message
include/linux/writeback.h +1 -2
@@ -90,7 +90,6 @@ struct writeback_control {* fs/fs-writeback.c */ struct bdi_writeback ; -int inode_wait (void *);void writeback_inodes_sb (struct super_block *,enum wb_reason reason);void writeback_inodes_sb_nr (struct super_block *,unsigned long nr,enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);static inline void wait_on_inode (struct inode *inode) {might_sleep (); -wait_on_bit (&inode->i_state, __I_NEW, inode_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&inode->i_state, __I_NEW,TASK_UNINTERRUPTIBLE ); }/*
kernel/ptrace.c +1 -7
@@ -28,12 +28,6 @@#include <linux/compat.h> -static int ptrace_trapping_sleep_fn (void *flags) -{ -schedule (); -return 0 ; -} -/* * ptrace a task: make the debugger its new parent and * move it to the ptrace list.
@@ -371,7 +365,7 @@ unlock_creds: out:if (!retval) {wait_on_bit (&task->jobctl,JOBCTL_TRAPPING_BIT , - ptrace_trapping_sleep_fn,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );proc_ptrace_connector (task,PTRACE_ATTACH ); }
kernel/sched/wait.c +18 -0
@@ -502,3 +502,21 @@ void wake_up_atomic_t(atomic_t *p)__wake_up_bit (atomic_t_waitqueue (p), p,WAIT_ATOMIC_T_BIT_NR ); }EXPORT_SYMBOL (wake_up_atomic_t); + +__sched int bit_wait(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait); + +__sched int bit_wait_io(void *word) +{ +if (signal_pending_state (current->state, current)) +return 1 ; +io_schedule (); +return 0 ; +} +EXPORT_SYMBOL (bit_wait_io);
mm/filemap.c +4 -16
@@ -241,18 +241,6 @@ void delete_from_page_cache(struct page *page) }EXPORT_SYMBOL (delete_from_page_cache); -static int sleep_on_page (void *word) -{ -io_schedule (); -return 0 ; -} - -static int sleep_on_page_killable (void *word) -{ -sleep_on_page (word); -return fatal_signal_pending (current) ? -EINTR :0 ; -} -static int filemap_check_errors (struct address_space *mapping) {int ret =0 ;
@@ -690,7 +678,7 @@ void wait_on_page_bit(struct page *page, int bit_nr)DEFINE_WAIT_BIT (wait, &page->flags, bit_nr);if (test_bit (bit_nr, &page->flags)) -__wait_on_bit (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (wait_on_page_bit);
@@ -703,7 +691,7 @@ int wait_on_page_bit_killable(struct page *page, int bit_nr)return 0 ;return __wait_on_bit (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }/**
@@ -770,7 +758,7 @@ void __lock_page(struct page *page) {DEFINE_WAIT_BIT (wait, &page->flags, PG_locked); -__wait_on_bit_lock (page_waitqueue (page), &wait, sleep_on_page, +__wait_on_bit_lock (page_waitqueue (page), &wait, bit_wait_io,TASK_UNINTERRUPTIBLE ); }EXPORT_SYMBOL (__lock_page);
@@ -780,7 +768,7 @@ int __lock_page_killable(struct page *page)DEFINE_WAIT_BIT (wait, &page->flags, PG_locked);return __wait_on_bit_lock (page_waitqueue (page), &wait, - sleep_on_page_killable,TASK_KILLABLE ); + bit_wait_io,TASK_KILLABLE ); }EXPORT_SYMBOL_GPL (__lock_page_killable);
mm/ksm.c +1 -7
@@ -1979,18 +1979,12 @@ void ksm_migrate_page(struct page *newpage, struct page *oldpage)#endif /* CONFIG_MIGRATION */ #ifdef CONFIG_MEMORY_HOTREMOVE -static int just_wait (void *word) -{ -schedule (); -return 0 ; -} -static void wait_while_offlining (void ) {while (ksm_run &KSM_RUN_OFFLINE ) {mutex_unlock (&ksm_thread_mutex);wait_on_bit (&ksm_run,ilog2 (KSM_RUN_OFFLINE ), - just_wait,TASK_UNINTERRUPTIBLE ); +TASK_UNINTERRUPTIBLE );mutex_lock (&ksm_thread_mutex); } }
net/bluetooth/hci_core.c +1 -7
@@ -2127,12 +2127,6 @@ static void hci_inq_req(struct hci_request *req, unsigned long opt)hci_req_add (req,HCI_OP_INQUIRY ,sizeof (cp), &cp); } -static int wait_inquiry (void *word) -{ -schedule (); -return signal_pending (current); -} -int hci_inquiry (void __user *arg) {__u8 __user *ptr = arg;
@@ -2183,7 +2177,7 @@ int hci_inquiry(void __user *arg)/* Wait until Inquiry procedure finishes (HCI_INQUIRY flag is * cleared). If it is interrupted by a signal, return -EINTR. */ -if (wait_on_bit (&hdev->flags,HCI_INQUIRY , wait_inquiry, +if (wait_on_bit (&hdev->flags,HCI_INQUIRY ,TASK_INTERRUPTIBLE ))return -EINTR ; }
security/keys/gc.c +1 -10
@@ -92,15 +92,6 @@ static void key_gc_timer_func(unsigned long data) }/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_gc_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* * Reap keys of dead type. * * We use three flags to make sure we see three complete cycles of the garbage
@@ -123,7 +114,7 @@ void key_gc_keytype(struct key_type *ktype)schedule_work (&key_gc_work);kdebug ("sleep" ); -wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE , key_gc_wait_bit, +wait_on_bit (&key_gc_flags,KEY_GC_REAPING_KEYTYPE ,TASK_UNINTERRUPTIBLE ); key_gc_dead_keytype =NULL ;
security/keys/request_key.c +2 -21
@@ -21,24 +21,6 @@#define key_negative_timeout 60/* default timeout on a negative key's existence */ -/* -* wait_on_bit() sleep function for uninterruptible waiting -*/ -static int key_wait_bit (void *flags) -{ -schedule (); -return 0 ; -} - -/* -* wait_on_bit() sleep function for interruptible waiting -*/ -static int key_wait_bit_intr (void *flags) -{ -schedule (); -return signal_pending (current) ? -ERESTARTSYS :0 ; -} -/** * complete_request_key - Complete the construction of a key. * @cons: The key construction record.
@@ -592,10 +574,9 @@ int wait_for_key_construction(struct key *key, bool intr)int ret; ret =wait_on_bit (&key->flags,KEY_FLAG_USER_CONSTRUCT , - intr ? key_wait_bit_intr : key_wait_bit, intr ?TASK_INTERRUPTIBLE :TASK_UNINTERRUPTIBLE ); -if (ret <0 ) -return ret; +if (ret) +return -ERESTARTSYS ;if (test_bit (KEY_FLAG_NEGATIVE , &key->flags)) {smp_rmb ();return key->type_data.reject_error;
Quoted 19 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.
Quoted 6 lines
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
this patch fails to build on x86-32 allyesconfigs.
Could we keep the old names for a while, and remove them in the next cycle or so?
Thanks,
Ingo
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 22 lines · On Thu, 22 May 2014 11:05:02 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 19 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.
Quoted 8 lines
Quoted 6 lines
Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.this patch fails to build on x86-32 allyesconfigs.
Could you share the build errors?
Quoted 3 lines
Could we keep the old names for a while, and remove them in the next cycle or so?
I don't see how changing the names later rather than now will reduce the chance of errors... maybe I'm missing something.
Thanks,
NeilBrown
Quoted 4 lines
Thanks,
Ingo
Quoted 31 lines · NeilBrown
Quoted 29 lines · On Thu, 22 May 2014 11:05:02 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 25 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
Quoted 3 lines
Quoted 1 line
this patch fails to build on x86-32 allyesconfigs.
Could you share the build errors?
Sure, find it attached below.
Quoted 6 lines
Quoted 3 lines
Could we keep the old names for a while, and remove them in the next cycle or so?
I don't see how changing the names later rather than now will reduce the chance of errors... maybe I'm missing something.
Well, it would reduce build errors?
Thanks,
Ingo
====================>fs/cifs/file.c: In function ‘cifs_oplock_break’:fs/cifs/file.c:3652:4: warning: passing argument 3 of ‘wait_on_bit’ makes integer from pointer without a cast [enabled by default]
cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE);
^
In file included from include/linux/fs.h:6:0,
from fs/cifs/file.c:24:include/linux/wait.h:878:1: note: expected ‘unsigned int’ but argument is of type ‘int (*)(void *)’
wait_on_bit(void *word, int bit, unsigned mode)
^fs/cifs/file.c:3652:4: error: too many arguments to function ‘wait_on_bit’
cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE);
^
In file included from include/linux/fs.h:6:0,
from fs/cifs/file.c:24:include/linux/wait.h:878:1: note: declared here
wait_on_bit(void *word, int bit, unsigned mode)
^
CC kernel/smp.o
CC kernel/trace/trace_event_perf.o
make[2]: *** [fs/cifs/file.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC drivers/bcma/sprom.o CC fs/btrfs/locking.o LD sound/isa/ad1848/snd-ad1848.o LD sound/isa/ad1848/built-in.o CC sound/isa/cs423x/cs4231.o CC lib/fonts/fonts.o CC lib/fonts/font_sun8x16.o CC drivers/bcma/driver_chipcommon.o CC lib/fonts/font_sun12x22.o
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 34 lines · On Thu, 5 Jun 2014 14:45:09 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 31 lines · NeilBrown
Quoted 29 lines · On Thu, 22 May 2014 11:05:02 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 25 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
this patch fails to build on x86-32 allyesconfigs.
Could you share the build errors?
Sure, find it attached below.
Thanks.
It looks like this is a wait_on_bit usage that was added after I created the patch.
How about you drop my patch for now, we wait for -rc1 to come out, then I submit a new version against -rc1 and we get that into -rc2. That should minimise such conflicts.
Does that work for you?
Thanks,
NeilBrown
Quoted 45 lines
Quoted 7 lines
Quoted 4 lines
Could we keep the old names for a while, and remove them in the next cycle or so?
I don't see how changing the names later rather than now will reduce the chance of errors... maybe I'm missing something.
Well, it would reduce build errors?
Thanks,
Ingo
====================>
fs/cifs/file.c: In function ‘cifs_oplock_break’:fs/cifs/file.c:3652:4: warning: passing argument 3 of ‘wait_on_bit’ makes integer from pointer without a cast [enabled by default]cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE); ^ In file included from include/linux/fs.h:6:0, from fs/cifs/file.c:24:
include/linux/wait.h:878:1: note: expected ‘unsigned int’ but argument is of type ‘int (*)(void *)’
wait_on_bit(void *word, int bit, unsigned mode)
^fs/cifs/file.c:3652:4: error: too many arguments to function ‘wait_on_bit’cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE); ^ In file included from include/linux/fs.h:6:0, from fs/cifs/file.c:24:
include/linux/wait.h:878:1: note: declared here
wait_on_bit(void *word, int bit, unsigned mode)
^
CCkernel/smp.o
CCkernel/trace/trace_event_perf.o
make[2]: *** [fs/cifs/file.o] Error 1
make[2]: *** Waiting for unfinished jobs....CC drivers/bcma/sprom.o CC fs/btrfs/locking.o LD sound/isa/ad1848/snd-ad1848.o LD sound/isa/ad1848/built-in.o CC sound/isa/cs423x/cs4231.o CC lib/fonts/fonts.o CC lib/fonts/font_sun8x16.o CC drivers/bcma/driver_chipcommon.o CC lib/fonts/font_sun12x22.o
Quoted 44 lines · NeilBrown
Quoted 34 lines · On Thu, 5 Jun 2014 14:45:09 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 31 lines · NeilBrown
Quoted 29 lines · On Thu, 22 May 2014 11:05:02 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 25 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.Quoted 5 lines
Quoted 3 lines
Quoted 1 line
this patch fails to build on x86-32 allyesconfigs.
Could you share the build errors?
Sure, find it attached below.
Thanks.
Quoted 8 lines
It looks like this is a
wait_on_bitusage that was added after I created the patch.How about you drop my patch for now, we wait for -rc1 to come out, then I submit a new version against -rc1 and we get that into -rc2. That should minimise such conflicts.
Does that work for you?
Sure, that sounds like a good approach, if Linus doesn't object.
Thanks,
Ingo
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 50 lines · On Fri, 6 Jun 2014 08:04:19 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 47 lines · NeilBrown
Quoted 34 lines · On Thu, 5 Jun 2014 14:45:09 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 31 lines · NeilBrown
Quoted 29 lines · On Thu, 22 May 2014 11:05:02 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 25 lines · NeilBrown
[[ get_maintainer.pl suggested 61 email address for this patch.
I've trimmed that list somewhat. Hope I didn't miss anyone important...
I'm hoping it will go in through the scheduler tree, but would particularly like an Acked-by for the fscache parts. Other acks welcome.
]]The current "
wait_on_bit" interface requires an 'action' function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical. Most cases can be satisfied by one of just two functions, one which usesio_schedule()and one which just usesschedule().So:
Renamewait_on_bitandwait_on_bit_lockto
wait_on_bit_actionandwait_on_bit_lock_action
to make it explicit that they need an action function.Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io which are *not* given an action function but implicitly use a standard one.
The decision to error-out if a signal is pending is now made based on the 'mode' argument rather than being encoded in the action function.Quoted 5 lines
Quoted 3 lines
Quoted 1 line
this patch fails to build on x86-32 allyesconfigs.
Could you share the build errors?
Sure, find it attached below.
Thanks.
It looks like this is a
wait_on_bitusage that was added after I created the patch.
Quoted 8 lines
Quoted 5 lines
How about you drop my patch for now, we wait for -rc1 to come out, then I submit a new version against -rc1 and we get that into -rc2. That should minimise such conflicts.
Does that work for you?
Sure, that sounds like a good approach, if Linus doesn't object.
Hi Ingo,
I re-posted these patches based on -rc2 (I missed -rc1, it was too fast) and have not heard anything over a week later. Did I misunderstand? Did you want me to send them direct to Linus?
Or are you on a summer break and I should just be patient?
Thanks,
NeilBrown