Linux block layer
 help / color / mirror / Atom feed
* [bug report] memcontrol: schedule throttling if we are congested
@ 2023-01-06 14:58 Dan Carpenter
  2023-01-06 17:33 ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2023-01-06 14:58 UTC (permalink / raw)
  To: tj; +Cc: linux-block

Hello Tejun Heo,

The patch 2cf855837b89: "memcontrol: schedule throttling if we are
congested" from Jul 3, 2018, leads to the following Smatch static
checker warning:

block/blk-cgroup.c:1863 blkcg_schedule_throttle() warn: sleeping in atomic context

The call tree looks like:

ioc_rqos_merge() <- disables preempt
__cgroup_throttle_swaprate() <- disables preempt
-> blkcg_schedule_throttle()

Here is one of the callers:
mm/swapfile.c
  3657          spin_lock(&swap_avail_lock);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Takes spin lock.

  3658          plist_for_each_entry_safe(si, next, &swap_avail_heads[nid],
  3659                                    avail_lists[nid]) {
  3660                  if (si->bdev) {
  3661                          blkcg_schedule_throttle(si->bdev->bd_disk, true);
                                ^^^^^^^^^^^^^^^^^^^^^^^
Calls blkcg_schedule_throttle().

  3662                          break;
  3663                  }
  3664          }

block/blk-cgroup.c
  1851  void blkcg_schedule_throttle(struct gendisk *disk, bool use_memdelay)
  1852  {
  1853          struct request_queue *q = disk->queue;
  1854  
  1855          if (unlikely(current->flags & PF_KTHREAD))
  1856                  return;
  1857  
  1858          if (current->throttle_queue != q) {
  1859                  if (!blk_get_queue(q))
  1860                          return;
  1861  
  1862                  if (current->throttle_queue)
  1863                          blk_put_queue(current->throttle_queue);
                                ^^^^^^^^^^^^^^
Sleeps.

  1864                  current->throttle_queue = q;
  1865          }
  1866  
  1867          if (use_memdelay)
  1868                  current->use_memdelay = use_memdelay;
  1869          set_notify_resume(current);
  1870  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-09  3:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06 14:58 [bug report] memcontrol: schedule throttling if we are congested Dan Carpenter
2023-01-06 17:33 ` Tejun Heo
2023-01-06 18:49   ` Jens Axboe
2023-01-06 19:09     ` Luis Chamberlain
2023-01-06 20:34     ` [PATCH block/for-6.2-fixes] block: Drop spurious might_sleep() from blk_put_queue() Tejun Heo
2023-01-06 20:45       ` Luis Chamberlain
2023-01-06 20:47         ` Tejun Heo
2023-01-06 20:52         ` Jens Axboe
2023-01-07  8:36         ` Dan Carpenter
2023-01-08 17:49       ` Christoph Hellwig
2023-01-09  3:30       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox