Messages in this thread | | | Date | Wed, 6 Mar 2019 18:03:46 +0100 | From | Jiri Bohac <> | Subject | Re: [PATCH v4] x86/gart/kcore: Exclude GART aperture from kcore |
| |
Hi,
On Wed, Mar 06, 2019 at 07:38:59PM +0800, Kairui Song wrote: > +int register_mem_pfn_is_ram(int (*fn)(unsigned long pfn)) > +{ > + if (mem_pfn_is_ram) > + return -EBUSY; > + mem_pfn_is_ram = fn; > + return 0; > +} > + > +void unregister_mem_pfn_is_ram(void) > +{ > + mem_pfn_is_ram = NULL; > +} > + > +static int pfn_is_ram(unsigned long pfn) > +{ > + if (mem_pfn_is_ram) > + return mem_pfn_is_ram(pfn); > + else > + return 1; > +} > +
If anyone were ever to use unregister_mem_pfn_is_ram(), pfn_is_ram() would become racy.
In V2 you had this: + fn = mem_pfn_is_ram; + if (fn) + ret = fn(pfn);
I agree it's unnecessary since nothing uses unregister_mem_pfn_is_ram(). But then I think it would be best to just drop the unregister function.
Otherwise the patch looks good to me.
-- Jiri Bohac <jbohac@suse.cz> SUSE Labs, Prague, Czechia
| |