From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FA4D3C1F for ; Sat, 9 May 2026 13:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778332653; cv=none; b=mzYyb/hugA5Eqhw8wuymjwcn2XFDXstGnChTHKV3XoEW4Yo6hqnq41GeSmts/a3Qxuw+h+1pE/GOJiQMPlaVtBSzi1k9nZZSfQOUOtfndvJRRUF9pkWvW5kSU6eJ1PH2EfQqR5Z/KFgKVvd80UkUrfaIJyrNM3W4GpZ/x2og2YQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778332653; c=relaxed/simple; bh=DFE6Rl5lepS1KiM7U/4LCoiGspIzgn2J1rhPK8AcZh4=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=cwBJzsAkNV6aWp+THpvm9/Od4ZouwkE829ZbddJWMESy9sW2o7tHk0hJmjRVKzB+dfEZSxxgOAYM1RIiLfiXKyDUYLxIU707fmnVmKw9thIVZN54BENp30WfQQTcVMZxPzPANrmwUGai8wfK5393/7Dxi5HQjVeImvEXuPn6SPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M/AlLZ8y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M/AlLZ8y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26C42C2BCB2; Sat, 9 May 2026 13:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778332653; bh=DFE6Rl5lepS1KiM7U/4LCoiGspIzgn2J1rhPK8AcZh4=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=M/AlLZ8y/gNZQ3Y5YQwGaMHBsL9Ft02h96ok3Mh5uf3xP8U9EIcyg1PHyzp/N1D/U 13PlTS4GKkkAcp4FTue9iy9GLYFEt2Hv5vNp2RKhn9Zw7j+2ekrdblccitBoxFmTDv hrK7nZuqY4m+At0wgW0ihV4HPCzxZaEnS3A8X/A4OuEK+ipvmG4WC6HqeqDikBOVGM tUNjt+SO3vozfNnovp+V+bzWayXjsRRZd9QGOms7DNGdnAl3wZe0Fc4ZaBNU9EYiLD z5Zu66JaAyQNyCvvmGma5crTdCfQHVHvEsP6i03n//ybhhoJ2WmWckNPawd+qPfcjY 0vLQsQ3iBoFpQ== Message-ID: <13da11c4-c6a5-46c3-b2c4-3a3dcb92cb5d@kernel.org> Date: Sat, 9 May 2026 21:17:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, baijiaju1990@gmail.com Subject: Re: [PATCH] f2fs: annotate lockless last_time[] accesses To: Cen Zhang , jaegeuk@kernel.org References: <20260506010709.3287111-1-zzzccc427@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260506010709.3287111-1-zzzccc427@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/6/26 09:07, Cen Zhang wrote: > f2fs stores mount-wide activity timestamps in sbi->last_time[] and > samples them from background discard, GC, and balance paths without a > dedicated lock. The timestamps are used as best-effort heuristics to > decide whether background work should run now or sleep a bit longer. > > The current helpers use plain loads and stores, so KCSAN can report races > between frequent foreground updates and background readers. Exact > freshness is not required here, but the intentional lockless accesses > should be marked explicitly. > > Use WRITE_ONCE() in f2fs_update_time() and READ_ONCE() in > f2fs_time_over() and f2fs_time_to_wait(). This preserves the existing > heuristic behavior and avoids adding locking to hot paths. > > Signed-off-by: Cen Zhang Reviewed-by: Chao Yu Thanks,