> As far as I understand the code, this would trigger an immediate > journal flush then under memory reclaim because this background wq is > only used to reschedule journal flush some time in the future (100ms?) > if there's nothing to write just now: Thinking about this again, the code looks like it tries to coalesce journal flushes into windows of 100ms, and the dirty flag is just used as an indicator to know whether the flush has already been queued. Is that true? > > } else if (!w->dirty) { > > w->dirty = true; > > - schedule_delayed_work(&c->journal.work, > > - msecs_to_jiffies(c->journal_delay_ms)); > > + queue_delayed_work(bch_background_wq, &c->journal.work, > > + msecs_to_jiffies(c->journal_delay_ms)); > > spin_unlock(&c->journal.lock); > > } else { This would mean we start performing worse under memory reclaim... Thanks, Kai