Skip to content

Commit b73a31a

Browse files
committed
use struct_group to avoid __write_overflow_field
1 parent 2406021 commit b73a31a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

fw/apm.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ typedef struct {
100100

101101
typedef struct {
102102
TfwPcntCtl ctl[TFW_STATS_RANGES];
103-
char __reset_from[0];
104-
unsigned long tot_cnt;
105-
unsigned long tot_val;
106-
unsigned int min_val;
107-
unsigned int max_val;
108-
unsigned long cnt[TFW_STATS_RANGES][TFW_STATS_BCKTS];
109-
char __reset_till[0];
103+
struct_group(reset,
104+
unsigned long tot_cnt;
105+
unsigned long tot_val;
106+
unsigned int min_val;
107+
unsigned int max_val;
108+
unsigned long cnt[TFW_STATS_RANGES][TFW_STATS_BCKTS];
109+
);
110110
} TfwPcntRanges __attribute__((aligned(L1_CACHE_BYTES)));
111111

112112
static inline unsigned long *
@@ -840,9 +840,7 @@ tfw_apm_prnctl_calc(TfwApmRBuf *rbuf, TfwApmRBCtl *rbctl, TfwPrcntlStats *pstats
840840
static inline void
841841
__tfw_apm_rbent_reset(TfwApmRBEnt *crbent, unsigned long jtmistamp)
842842
{
843-
memset(crbent->pcntrng.__reset_from, 0,
844-
offsetof(TfwPcntRanges, __reset_till)
845-
- offsetof(TfwPcntRanges, __reset_from));
843+
memset(&crbent->pcntrng.reset, 0, sizeof(crbent->pcntrng.reset));
846844
crbent->pcntrng.min_val = UINT_MAX;
847845
crbent->jtmistamp = jtmistamp;
848846
smp_mb__before_atomic();
@@ -1020,6 +1018,8 @@ tfw_apm_prcntl_tmfn(struct timer_list *t)
10201018
TfwApmRBuf *rbuf = &data->rbuf;
10211019
TfwApmRBEnt *rbent = rbuf->rbent;
10221020

1021+
kernel_fpu_begin();
1022+
10231023
/*
10241024
* Increment the counter and make the updates use the other array
10251025
* of the two that are available. In the meanwhile, use the array
@@ -1059,6 +1059,8 @@ tfw_apm_hm_timer_cb(struct timer_list *t)
10591059
TfwApmHM *hm = READ_ONCE(hmctl->hm);
10601060
unsigned long now;
10611061

1062+
kernel_fpu_begin();
1063+
10621064
BUG_ON(!hm);
10631065
if (!atomic64_read(&hmctl->rcount))
10641066
tfw_http_hm_srv_send(srv, hm->req, hm->reqsz);

0 commit comments

Comments
 (0)