lkml.org 
[lkml]   [2019]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-03-06 18:05    [W:0.041 / U:1.772 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site