public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Haoran Luo <www@aegistudio.net>
To: Haoran Luo <www@aegistudio.net>
Cc: axboe@kernel.dk, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, tj@kernel.org, zhangyoufu@gmail.com
Subject: Re: [BUG] blk-throttle panic on 32bit machine after startup
Date: Mon, 18 Oct 2021 09:25:11 +0000	[thread overview]
Message-ID: <YW09dxyhhsMwaO7T@aegistudio> (raw)

Pardon me for elaborating some of my opinions.

> I think this piece of code presumes all jiffies values are greater than
> 0, which is the initial value assigned when kzalloc-ing throtl_grp. It
> fails on 32-bit linux for the first 5 minutes after booting, since the
> jiffies value then will be less than 0.

Expressing the jiffies value as greater or less than 0 is a mistake of vagueness. I actually means that comparison in macro "time_after_eq", which written as below in "5.16-rc2" in "include/linux/jiffies.h" at around line 110.

	#define time_after_eq(a,b)	\
		(typecheck(unsigned long, a) && \
		 typecheck(unsigned long, b) && \
		 ((long)((a) - (b)) >= 0))

The "INITIAL_JIFFIES" which is defined as "((unsigned long)(unsigned int)-300*HZ)", converts to "((long)-300*HZ)" and is smaller than "((long)0)". And similarily "timer_after_eq(x, 0)" being evaluated to false holds for x ranged from `INITIAL_JIFFIES <= x <= MAX_LONG` on 32-bit linux.

The same thing will not happen for 64-bit linux, since "((unsigned long)(unsigned int)-300*HZ)" is evaluated to a value greater than zero in the macro above.

I actually cannot figure out a fix for this problem on 32-bit, if it presumes the jiffies value in "tg->slice_start[rw]" to be either "0" or jiffies "x" holding property of "time_after_eq(x, 0)".

             reply	other threads:[~2021-10-18  9:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18  9:25 Haoran Luo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-18  8:00 [BUG] blk-throttle panic on 32bit machine after startup Haoran Luo
2021-10-18  7:08 Youfu Zhang
2021-10-18 15:22 ` Liqueur Librazy
2021-10-19 17:45 ` Tejun Heo
2021-10-21  4:26   ` Youfu Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YW09dxyhhsMwaO7T@aegistudio \
    --to=www@aegistudio.net \
    --cc=YW0pm5xcxgWnW98f@aegistudio \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=zhangyoufu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox