Re: [PATCH v3 4/6] x86/MCE: Make number of MCA banks per_cpu
From: Borislav Petkov
Date: Tue May 21 2019 - 19:11:36 EST
On Tue, May 21, 2019 at 01:42:40PM -0700, Luck, Tony wrote:
> On Tue, May 21, 2019 at 10:29:02PM +0200, Borislav Petkov wrote:
> >
> > Can we do instead:
> >
> > -static DEFINE_PER_CPU_READ_MOSTLY(struct mce_bank *, mce_banks_array);
> > +static DEFINE_PER_CPU_READ_MOSTLY(struct mce_bank, mce_banks_array[MAX_NR_BANKS]);
> >
> > which should be something like 9*32 = 288 bytes per CPU.
> >
>
> Where did you get the "9" from? struct mce_bank looks to
> be over 50 bytes.
Patch 2/6 changes that:
struct mce_bank {
u64 ctl; /* subevents to enable */
bool init; /* initialise bank? */
+};
+static DEFINE_PER_CPU_READ_MOSTLY(struct mce_bank *, mce_banks_percpu);
+
+#define ATTR_LEN 16
+/* One object for each MCE bank, shared by all CPUs */
+struct mce_bank_dev {
struct device_attribute attr; /* device attribute */
char attrname[ATTR_LEN]; /* attribute name */
+ u8 bank; /* bank number */
};
+static struct mce_bank_dev mce_bank_devs[MAX_NR_BANKS];
> Still only 1.5K per cpu though.
Yah, I think that using static per-CPU memory should be better than
GFP_ATOMIC.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply. Srsly.