Message ID | 534f275016296996f54ecf65168bb3392b6f653d.1591699601.git.riteshh@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [PATCHv2,1/1] ext4: mballoc: Use this_cpu_read instead of this_cpu_ptr | expand |
On Tue, Jun 09, 2020 at 04:23:10PM +0530, Ritesh Harjani wrote: > Simplify reading a seq variable by directly using this_cpu_read API > instead of doing this_cpu_ptr and then dereferencing it. > > This also avoid the below kernel BUG: which happens when > CONFIG_DEBUG_PREEMPT is enabled I see this warning all the time with ext4 using tests VMs, so lets get this fixed ASAP before -rc1: Reviewed-by: Christoph Hellwig <hch@lst.de>
On 6/10/20 11:55 AM, Christoph Hellwig wrote: > On Tue, Jun 09, 2020 at 04:23:10PM +0530, Ritesh Harjani wrote: >> Simplify reading a seq variable by directly using this_cpu_read API >> instead of doing this_cpu_ptr and then dereferencing it. >> >> This also avoid the below kernel BUG: which happens when >> CONFIG_DEBUG_PREEMPT is enabled > > I see this warning all the time with ext4 using tests VMs, so lets get > this fixed ASAP before -rc1: Couldn't agree more. > > Reviewed-by: Christoph Hellwig <hch@lst.de> > Thanks -ritesh
On Tue, Jun 09, 2020 at 11:25:38PM -0700, Christoph Hellwig wrote: > On Tue, Jun 09, 2020 at 04:23:10PM +0530, Ritesh Harjani wrote: > > Simplify reading a seq variable by directly using this_cpu_read API > > instead of doing this_cpu_ptr and then dereferencing it. > > > > This also avoid the below kernel BUG: which happens when > > CONFIG_DEBUG_PREEMPT is enabled > > I see this warning all the time with ext4 using tests VMs, so lets get > this fixed ASAP before -rc1: > > Reviewed-by: Christoph Hellwig <hch@lst.de> Thanks, applied. - Ted
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index a9083113a8c0..c0a331e2feb0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4708,7 +4708,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, } ac->ac_op = EXT4_MB_HISTORY_PREALLOC; - seq = *this_cpu_ptr(&discard_pa_seq); + seq = this_cpu_read(discard_pa_seq); if (!ext4_mb_use_preallocated(ac)) { ac->ac_op = EXT4_MB_HISTORY_ALLOC; ext4_mb_normalize_request(ac, ar);