mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hao Jia <jiahao.kernel@gmail.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	minchan@kernel.org, axboe@kernel.dk, bgeffon@google.com,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] zram: fix idle age_sec underflow in idle_store()
Date: Tue, 1 Sep 2026 10:02:20 +0800	[thread overview]
Message-ID: <7b007eef-2f6d-c86a-065b-85eb85b5ee0f@gmail.com> (raw)
In-Reply-To: <apVK4g2ikVJe_Hcg@google.com>



On 2026/8/31 17:38, Sergey Senozhatsky wrote:
> On (26/08/31 16:37), Hao Jia wrote:
>> On 2026/8/31 12:15, Sergey Senozhatsky wrote:
>>> On (26/08/28 10:24), Andrew Morton wrote:
>>>> On Fri, 28 Aug 2026 16:31:49 +0800 Hao Jia <jiahao.kernel@gmail.com> wrote:
>>> [..]
>>>>
>>>> Thanks.  Sashiko asked a couple of questions about this change:
>>>> 	https://sashiko.dev/#/patchset/20260828083149.45760-1-jiahao.kernel@gmail.com
>>>
>>>
>>>> Does this early return prevent marking valid boot-time pages as idle?
>>>> When a page is accessed during the first second of system boot, its ac_time
>>>> would be 0.
>>>
>>> There is no possibility for zram to hold pages during first second of
>>> system boot, regardless of whether zram was configured as a swap device
>>> or as a block device (mount-ed with real filesystem).
>>>
>>>
>>>> Can the early return above bypass this zram device initialization check?
>>>
>>> We already do that, e.g. when kstrtouint(buf, 0, &age_sec) fails.  Apart
>>> from that, that's not how one checks if device was initialized.  We may
>>> want to consolidate those checks, just for symmetry.
>>
>> Agreed on both points -- the early return is not a new "bypass", and
>> the write() return value was never a way to probe init state.
>>
>> How about moving the init_done() check to the top, so all the early
>> returns sit behind the same device-state check?
> 
> Yeah, I don't know...  Moving it under device lock doesn't buy us
> anything.  We don't need device lock to validate integer rangers,
> etc.  There are validations that we need to do under device lock
> because those require a consistent device state.  But things like
> "is system uptime less than supplied sysfs data" don't logically
> require a device lock.

Thanks for the clarification. The current patch is enough, so no change 
is needed.

Thanks,
Hao

      reply	other threads:[~2026-09-01  2:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  8:31 Hao Jia
2026-08-28  9:20 ` Sergey Senozhatsky
2026-08-28 17:24 ` Andrew Morton
2026-08-31  4:15   ` Sergey Senozhatsky
2026-08-31  8:37     ` Hao Jia
2026-08-31  9:38       ` Sergey Senozhatsky
2026-09-01  2:02         ` Hao Jia [this message]

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=7b007eef-2f6d-c86a-065b-85eb85b5ee0f@gmail.com \
    --to=jiahao.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bgeffon@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®