Skip to content

Commit 4aede84

Browse files
jteravestJens Axboe
authored andcommitted
fixlet: Remove fs_excl from struct task.
fs_excl is a poor man's priority inheritance for filesystems to hint to the block layer that an operation is important. It was never clearly specified, not widely adopted, and will not prevent starvation in many cases (like across cgroups). fs_excl was introduced with the time sliced CFQ IO scheduler, to indicate when a process held FS exclusive resources and thus needed a boost. It doesn't cover all file systems, and it was never fully complete. Lets kill it. Signed-off-by: Justin TerAvest <teravest@google.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent a07405b commit 4aede84

8 files changed

Lines changed: 1 addition & 52 deletions

File tree

‎block/cfq-iosched.c‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct cfq_queue {
134134

135135
/* io prio of this group */
136136
unsigned short ioprio, org_ioprio;
137-
unsigned short ioprio_class, org_ioprio_class;
137+
unsigned short ioprio_class;
138138

139139
pid_t pid;
140140

@@ -2869,7 +2869,6 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc)
28692869
* elevate the priority of this queue
28702870
*/
28712871
cfqq->org_ioprio = cfqq->ioprio;
2872-
cfqq->org_ioprio_class = cfqq->ioprio_class;
28732872
cfq_clear_cfqq_prio_changed(cfqq);
28742873
}
28752874

@@ -3593,30 +3592,6 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
35933592
cfq_schedule_dispatch(cfqd);
35943593
}
35953594

3596-
/*
3597-
* we temporarily boost lower priority queues if they are holding fs exclusive
3598-
* resources. they are boosted to normal prio (CLASS_BE/4)
3599-
*/
3600-
static void cfq_prio_boost(struct cfq_queue *cfqq)
3601-
{
3602-
if (has_fs_excl()) {
3603-
/*
3604-
* boost idle prio on transactions that would lock out other
3605-
* users of the filesystem
3606-
*/
3607-
if (cfq_class_idle(cfqq))
3608-
cfqq->ioprio_class = IOPRIO_CLASS_BE;
3609-
if (cfqq->ioprio > IOPRIO_NORM)
3610-
cfqq->ioprio = IOPRIO_NORM;
3611-
} else {
3612-
/*
3613-
* unboost the queue (if needed)
3614-
*/
3615-
cfqq->ioprio_class = cfqq->org_ioprio_class;
3616-
cfqq->ioprio = cfqq->org_ioprio;
3617-
}
3618-
}
3619-
36203595
static inline int __cfq_may_queue(struct cfq_queue *cfqq)
36213596
{
36223597
if (cfq_cfqq_wait_request(cfqq) && !cfq_cfqq_must_alloc_slice(cfqq)) {
@@ -3647,7 +3622,6 @@ static int cfq_may_queue(struct request_queue *q, int rw)
36473622
cfqq = cic_to_cfqq(cic, rw_is_sync(rw));
36483623
if (cfqq) {
36493624
cfq_init_prio_data(cfqq, cic->ioc);
3650-
cfq_prio_boost(cfqq);
36513625

36523626
return __cfq_may_queue(cfqq);
36533627
}

‎fs/reiserfs/journal.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -678,23 +678,19 @@ struct buffer_chunk {
678678
static void write_chunk(struct buffer_chunk *chunk)
679679
{
680680
int i;
681-
get_fs_excl();
682681
for (i = 0; i < chunk->nr; i++) {
683682
submit_logged_buffer(chunk->bh[i]);
684683
}
685684
chunk->nr = 0;
686-
put_fs_excl();
687685
}
688686

689687
static void write_ordered_chunk(struct buffer_chunk *chunk)
690688
{
691689
int i;
692-
get_fs_excl();
693690
for (i = 0; i < chunk->nr; i++) {
694691
submit_ordered_buffer(chunk->bh[i]);
695692
}
696693
chunk->nr = 0;
697-
put_fs_excl();
698694
}
699695

700696
static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh,
@@ -986,8 +982,6 @@ static int flush_commit_list(struct super_block *s,
986982
return 0;
987983
}
988984

989-
get_fs_excl();
990-
991985
/* before we can put our commit blocks on disk, we have to make sure everyone older than
992986
** us is on disk too
993987
*/
@@ -1145,7 +1139,6 @@ static int flush_commit_list(struct super_block *s,
11451139
if (retval)
11461140
reiserfs_abort(s, retval, "Journal write error in %s",
11471141
__func__);
1148-
put_fs_excl();
11491142
return retval;
11501143
}
11511144

@@ -1374,8 +1367,6 @@ static int flush_journal_list(struct super_block *s,
13741367
return 0;
13751368
}
13761369

1377-
get_fs_excl();
1378-
13791370
/* if all the work is already done, get out of here */
13801371
if (atomic_read(&(jl->j_nonzerolen)) <= 0 &&
13811372
atomic_read(&(jl->j_commit_left)) <= 0) {
@@ -1597,7 +1588,6 @@ static int flush_journal_list(struct super_block *s,
15971588
put_journal_list(s, jl);
15981589
if (flushall)
15991590
mutex_unlock(&journal->j_flush_mutex);
1600-
put_fs_excl();
16011591
return err;
16021592
}
16031593

@@ -3108,7 +3098,6 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
31083098
th->t_trans_id = journal->j_trans_id;
31093099
unlock_journal(sb);
31103100
INIT_LIST_HEAD(&th->t_list);
3111-
get_fs_excl();
31123101
return 0;
31133102

31143103
out_fail:
@@ -3964,7 +3953,6 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
39643953
flush = flags & FLUSH_ALL;
39653954
wait_on_commit = flags & WAIT;
39663955

3967-
put_fs_excl();
39683956
current->journal_info = th->t_handle_save;
39693957
reiserfs_check_lock_depth(sb, "journal end");
39703958
if (journal->j_len == 0) {
@@ -4316,4 +4304,3 @@ void reiserfs_abort_journal(struct super_block *sb, int errno)
43164304
dump_stack();
43174305
#endif
43184306
}
4319-

‎fs/super.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,11 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
245245
*/
246246
void lock_super(struct super_block * sb)
247247
{
248-
get_fs_excl();
249248
mutex_lock(&sb->s_lock);
250249
}
251250

252251
void unlock_super(struct super_block * sb)
253252
{
254-
put_fs_excl();
255253
mutex_unlock(&sb->s_lock);
256254
}
257255

@@ -280,7 +278,6 @@ void generic_shutdown_super(struct super_block *sb)
280278
if (sb->s_root) {
281279
shrink_dcache_for_umount(sb);
282280
sync_filesystem(sb);
283-
get_fs_excl();
284281
sb->s_flags &= ~MS_ACTIVE;
285282

286283
fsnotify_unmount_inodes(&sb->s_inodes);
@@ -295,7 +292,6 @@ void generic_shutdown_super(struct super_block *sb)
295292
"Self-destruct in 5 seconds. Have a nice day...\n",
296293
sb->s_id);
297294
}
298-
put_fs_excl();
299295
}
300296
spin_lock(&sb_lock);
301297
/* should be initialized for __put_super_and_need_restart() */

‎include/linux/fs.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,10 +1453,6 @@ enum {
14531453
#define vfs_check_frozen(sb, level) \
14541454
wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
14551455

1456-
#define get_fs_excl() atomic_inc(&current->fs_excl)
1457-
#define put_fs_excl() atomic_dec(&current->fs_excl)
1458-
#define has_fs_excl() atomic_read(&current->fs_excl)
1459-
14601456
/*
14611457
* until VFS tracks user namespaces for inodes, just make all files
14621458
* belong to init_user_ns

‎include/linux/init_task.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ extern struct cred init_cred;
176176
.alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
177177
.journal_info = NULL, \
178178
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
179-
.fs_excl = ATOMIC_INIT(0), \
180179
.pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
181180
.timer_slack_ns = 50000, /* 50 usec default slack */ \
182181
.pids = { \

‎include/linux/sched.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,6 @@ struct task_struct {
15031503
short il_next;
15041504
short pref_node_fork;
15051505
#endif
1506-
atomic_t fs_excl; /* holding fs exclusive resources */
15071506
struct rcu_head rcu;
15081507

15091508
/*

‎kernel/exit.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ NORET_TYPE void do_exit(long code)
906906

907907
profile_task_exit(tsk);
908908

909-
WARN_ON(atomic_read(&tsk->fs_excl));
910909
WARN_ON(blk_needs_flush_plug(tsk));
911910

912911
if (unlikely(in_interrupt()))

‎kernel/fork.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
291291

292292
/* One for us, one for whoever does the "release_task()" (usually parent) */
293293
atomic_set(&tsk->usage,2);
294-
atomic_set(&tsk->fs_excl, 0);
295294
#ifdef CONFIG_BLK_DEV_IO_TRACE
296295
tsk->btrace_seq = 0;
297296
#endif

0 commit comments

Comments
 (0)