Re: linux-next: manual merge of the sysctl tree with Linus' tree
From: Stephen Rothwell
Date: Mon Mar 20 2023 - 22:22:37 EST
Hi all,
On Tue, 21 Mar 2023 13:20:52 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> Today's linux-next merge of the sysctl tree got a conflict in:
>
> mm/memory-failure.c
>
> between commit:
>
> 44b8f8bf2438 ("mm: memory-failure: add memory failure stats to sysfs")
>
> from Linus' tree and commit:
>
> cfe7e6ea5ee2 ("mm: memory-failure: Move memory failure sysctls to its own file")
>
> from the sysctl tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
Sorry, I forgot the resolution - see below.
--
Cheers,
Stephen Rothwell
diff --cc mm/memory-failure.c
index f761704d27d7,242b6cae0035..000000000000
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@@ -87,41 -88,36 +88,71 @@@ inline void num_poisoned_pages_sub(unsi
memblk_nr_poison_sub(pfn, i);
}
+/**
+ * MF_ATTR_RO - Create sysfs entry for each memory failure statistics.
+ * @_name: name of the file in the per NUMA sysfs directory.
+ */
+#define MF_ATTR_RO(_name) \
+static ssize_t _name##_show(struct device *dev, \
+ struct device_attribute *attr, \
+ char *buf) \
+{ \
+ struct memory_failure_stats *mf_stats = \
+ &NODE_DATA(dev->id)->mf_stats; \
+ return sprintf(buf, "%lu\n", mf_stats->_name); \
+} \
+static DEVICE_ATTR_RO(_name)
+
+MF_ATTR_RO(total);
+MF_ATTR_RO(ignored);
+MF_ATTR_RO(failed);
+MF_ATTR_RO(delayed);
+MF_ATTR_RO(recovered);
+
+static struct attribute *memory_failure_attr[] = {
+ &dev_attr_total.attr,
+ &dev_attr_ignored.attr,
+ &dev_attr_failed.attr,
+ &dev_attr_delayed.attr,
+ &dev_attr_recovered.attr,
+ NULL,
+};
+
+const struct attribute_group memory_failure_attr_group = {
+ .name = "memory_failure",
+ .attrs = memory_failure_attr,
+};
+
+ #ifdef CONFIG_SYSCTL
+ static struct ctl_table memory_failure_table[] = {
+ {
+ .procname = "memory_failure_early_kill",
+ .data = &sysctl_memory_failure_early_kill,
+ .maxlen = sizeof(sysctl_memory_failure_early_kill),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ {
+ .procname = "memory_failure_recovery",
+ .data = &sysctl_memory_failure_recovery,
+ .maxlen = sizeof(sysctl_memory_failure_recovery),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ };
+
+ static int __init memory_failure_sysctl_init(void)
+ {
+ register_sysctl_init("vm", memory_failure_table);
+ return 0;
+ }
+ late_initcall(memory_failure_sysctl_init);
+ #endif /* CONFIG_SYSCTL */
+
/*
* Return values:
* 1: the page is dissolved (if needed) and taken off from buddy,
Attachment:
pgpwACyf5jxdP.pgp
Description: OpenPGP digital signature