mm: Change global memory state symbols to GPL-only
Subsystems (4)
PATCH 1/1 mm: Change global memory state symbols to GPL-only
Proprietary modules should not be able to touch vm_stat or participate in shrinking.
--- mm/vmscan.c | 4 ++-- mm/vmstat.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
mm/vmscan.c +2 -2
@@ -247,7 +247,7 @@ int register_shrinker(struct shrinker *shrinker)up_write (&shrinker_rwsem);return 0 ; } -EXPORT_SYMBOL (register_shrinker); +EXPORT_SYMBOL_GPL (register_shrinker);/* * Remove one
@@ -259,7 +259,7 @@ void unregister_shrinker(struct shrinker *shrinker)up_write (&shrinker_rwsem);kfree (shrinker->nr_deferred); } -EXPORT_SYMBOL (unregister_shrinker); +EXPORT_SYMBOL_GPL (unregister_shrinker);#define SHRINK_BATCH 128
mm/vmstat.c +1 -1
@@ -87,7 +87,7 @@ void vm_events_fold_cpu(int cpu)* vm_stat contains the global counters */ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS] __cacheline_aligned_in_smp; -EXPORT_SYMBOL (vm_stat); +EXPORT_SYMBOL_GPL (vm_stat);#ifdef CONFIG_SMP
Signature · 4 lines
Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
Michal Hocko
reviewerQuoted 2 lines · Ben Hutchings
Proprietary modules should not be able to touch
vm_stator participate in shrinking.
How does the external and !GPL fs does slab reclaim? Those are essential for the proper memory balancing.
You are probably right about vm_stat though. Those counters should be out of those modules.
Quoted 47 lines
Signed-off-by Ben Hutchings <[email protected]>--- mm/vmscan.c | 4 ++-- mm/vmstat.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)mm/vmscan.c +2
-2@@ -247,7 +247,7 @@ int register_shrinker(struct shrinker *shrinker)up_write (&shrinker_rwsem);return 0 ; } -EXPORT_SYMBOL (register_shrinker); +EXPORT_SYMBOL_GPL (register_shrinker);/* * Remove one @@ -259,7 +259,7 @@ void unregister_shrinker(struct shrinker *shrinker)up_write (&shrinker_rwsem);kfree (shrinker->nr_deferred); } -EXPORT_SYMBOL (unregister_shrinker); +EXPORT_SYMBOL_GPL (unregister_shrinker);#define SHRINK_BATCH 128mm/vmstat.c +1
-1@@ -87,7 +87,7 @@ void vm_events_fold_cpu(int cpu)* vm_stat contains the global counters */ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS] __cacheline_aligned_in_smp; -EXPORT_SYMBOL (vm_stat); +EXPORT_SYMBOL_GPL (vm_stat);#ifdef CONFIG_SMP Signature · 4 lines
Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 6 lines · Michal Hocko
Quoted 2 lines · Ben Hutchings
Proprietary modules should not be able to touch
vm_stator participate in shrinking.How does the external and !GPL fs does slab reclaim? Those are essential for the proper memory balancing.
If they know how to do shrinking on Linux then they are probably derivative works of Linux.
Ben.
Quoted 53 lines
You are probably right about
vm_statthough. Those counters should be out of those modules.Quoted 47 lines
Signed-off-by Ben Hutchings <[email protected]>--- mm/vmscan.c | 4 ++-- mm/vmstat.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)mm/vmscan.c +2
-2@@ -247,7 +247,7 @@ int register_shrinker(struct shrinker *shrinker) > > > > up_write(&shrinker_rwsem); > > > > return 0; } -EXPORT_SYMBOL (register_shrinker); +EXPORT_SYMBOL_GPL (register_shrinker);/* * Remove one @@ -259,7 +259,7 @@ void unregister_shrinker(struct shrinker *shrinker) > > > > up_write(&shrinker_rwsem); > > > > kfree(shrinker->nr_deferred); } -EXPORT_SYMBOL (unregister_shrinker); +EXPORT_SYMBOL_GPL (unregister_shrinker);#define SHRINK_BATCH 128mm/vmstat.c +1
-1@@ -87,7 +87,7 @@ void vm_events_fold_cpu(int cpu)* vm_stat contains the global counters */ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS] __cacheline_aligned_in_smp; -EXPORT_SYMBOL (vm_stat); +EXPORT_SYMBOL_GPL (vm_stat);#ifdef CONFIG_SMP Signature · 4 lines
Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
Signature · 4 lines
Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
Michal Hocko
reviewerQuoted 10 lines · Ben Hutchings
Quoted 6 lines · Michal Hocko
Quoted 2 lines · Ben Hutchings
Proprietary modules should not be able to touch
vm_stator participate in shrinking.How does the external and !GPL fs does slab reclaim? Those are essential for the proper memory balancing.
If they know how to do shrinking on Linux then they are probably derivative works of Linux.
I am not sure I understand. They are shrinking their internal cached objects and that is hardly a derivative work. The shrinker API is only meant to let them know _when_ this should happen and the interface is a pretty much simple callback API.
I do not want to defend a proprietary code here but this sounds like an obstruction for those modules which will lead into a worse code in the end because they should somehow manage the cache and it is much better when the core (MM) tells them when it makes sense rather than external heuristics.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 9 lines · Michal Hocko
Quoted 8 lines · Ben Hutchings
Quoted 6 lines · Michal Hocko
Quoted 2 lines · Ben Hutchings
Proprietary modules should not be able to touch
vm_stator participate in shrinking.How does the external and !GPL fs does slab reclaim? Those are essential for the proper memory balancing.
Quoted 7 lines
Quoted 2 lines
If they know how to do shrinking on Linux then they are probably derivative works of Linux.
I am not sure I understand. They are shrinking their internal cached objects and that is hardly a derivative work. The shrinker API is only meant to let them know _when_ this should happen and the interface is a pretty much simple callback API.
It is a Linux-specific API and I don't think other kernels provide something similar to loadable modules. It enables a module to turn a large part of the system RAM into a cache and have the MM effectively tell it the correct size of that cache, thus tightly integrating with global memory management.
It seemed to me that this met the test for 'should this be EXPORT_SYMBOL_GPL'.
Quoted 5 lines
I do not want to defend a proprietary code here but this sounds like an obstruction for those modules which will lead into a worse code in the end because they should somehow manage the cache and it is much better when the core (MM) tells them when it makes sense rather than external heuristics.
Yes, that's the idea, proprietary code should not be helped in this way.
Ben.
Signature · 4 lines
Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949