All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Export __vmalloc_node symbol
@ 2015-02-02  3:10 green
  2015-02-02  3:10 ` [PATCH 1/2] mm: Export __vmalloc_node green
  2015-02-02  3:10 ` [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default green
  0 siblings, 2 replies; 7+ messages in thread
From: green @ 2015-02-02  3:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Looking to get rid of a deadlock in Lustre where vmalloc call recurses
right back into Lustre to free some memory due to not accepting GFP mask
I noticed that while vzalloc is replaceable with __vmalloc just as
suggested, vzalloc_node is not. Recommended __vmalloc_node symbol is
static to mm/vmalloc.c.
Hopefully nobody has any objections to me exporting it so that
vzalloc_node suggestion actually becomes possible.

Second patch in the series is just a Lustre patch to take advantage
of that newly exported symbol (as an example of usage).

Please consider.

Bruno Faccini (1):
  staging/lustre: use __vmalloc_node() to avoid __GFP_FS default

Oleg Drokin (1):
  mm: Export __vmalloc_node

 drivers/staging/lustre/lustre/include/obd_support.h | 18 ++++++++++++------
 include/linux/vmalloc.h                             |  3 +++
 mm/vmalloc.c                                        | 10 ++++------
 3 files changed, 19 insertions(+), 12 deletions(-)

-- 
2.1.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] mm: Export __vmalloc_node
  2015-02-02  3:10 [PATCH 0/2] Export __vmalloc_node symbol green
@ 2015-02-02  3:10 ` green
  2015-02-02 17:45   ` David Rientjes
  2015-02-02  3:10 ` [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default green
  1 sibling, 1 reply; 7+ messages in thread
From: green @ 2015-02-02  3:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

vzalloc_node helpfully suggests to use __vmalloc_node if a more tight
control over allocation flags is needed, but in fact __vmalloc_node
is not only not exported, it's also static, so could not be used
outside of mm/vmalloc.c
Make it to be available as it was apparently intended.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 include/linux/vmalloc.h |  3 +++
 mm/vmalloc.c            | 10 ++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index b87696f..7eb2c46 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -73,6 +73,9 @@ extern void *vmalloc_exec(unsigned long size);
 extern void *vmalloc_32(unsigned long size);
 extern void *vmalloc_32_user(unsigned long size);
 extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
+extern void *__vmalloc_node(unsigned long size, unsigned long align,
+			    gfp_t gfp_mask, pgprot_t prot, int node,
+			    const void *caller);
 extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
 			unsigned long start, unsigned long end, gfp_t gfp_mask,
 			pgprot_t prot, int node, const void *caller);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 39c3388..b882d95 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1552,9 +1552,6 @@ void *vmap(struct page **pages, unsigned int count,
 }
 EXPORT_SYMBOL(vmap);
 
-static void *__vmalloc_node(unsigned long size, unsigned long align,
-			    gfp_t gfp_mask, pgprot_t prot,
-			    int node, const void *caller);
 static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 				 pgprot_t prot, int node)
 {
@@ -1685,13 +1682,14 @@ fail:
  *	allocator with @gfp_mask flags.  Map them into contiguous
  *	kernel virtual space, using a pagetable protection of @prot.
  */
-static void *__vmalloc_node(unsigned long size, unsigned long align,
-			    gfp_t gfp_mask, pgprot_t prot,
-			    int node, const void *caller)
+void *__vmalloc_node(unsigned long size, unsigned long align,
+		     gfp_t gfp_mask, pgprot_t prot, int node,
+		     const void *caller)
 {
 	return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
 				gfp_mask, prot, node, caller);
 }
+EXPORT_SYMBOL(__vmalloc_node);
 
 void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
 {
-- 
2.1.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default
  2015-02-02  3:10 [PATCH 0/2] Export __vmalloc_node symbol green
  2015-02-02  3:10 ` [PATCH 1/2] mm: Export __vmalloc_node green
@ 2015-02-02  3:10 ` green
  2015-02-02 17:48   ` David Rientjes
  1 sibling, 1 reply; 7+ messages in thread
From: green @ 2015-02-02  3:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Bruno Faccini, Oleg Drokin

From: Bruno Faccini <bruno.faccini@intel.com>

When possible, try to use of __vmalloc_node() instead of
vzalloc/vzalloc_node which allows for protection flag specification,
and particularly to not set __GFP_FS, which can cause some deadlock
situations in our code due to recursive calls.

Additionally fixed a typo in the macro name: VEROBSE->VERBOSE

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/11190
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5349
---
 drivers/staging/lustre/lustre/include/obd_support.h | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 2991d2e..c90a88e 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -655,11 +655,17 @@ do {									      \
 #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
 	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
 
-# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)			      \
+/* Direct use of __vmalloc_node() allows for protection flag specification
+ * (and particularly to not set __GFP_FS, which is likely to cause some
+ * deadlock situations in our code).
+ */
+# define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)			      \
 do {									      \
-	(ptr) = cptab == NULL ?						      \
-		vzalloc(size) :						      \
-		vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt));	      \
+	(ptr) = __vmalloc_node(size, 1, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,\
+			       PAGE_KERNEL,				      \
+			       cptab == NULL ? NUMA_NO_NODE :		      \
+					      cfs_cpt_spread_node(cptab, cpt),\
+			       __builtin_return_address(0));		      \
 	if (unlikely((ptr) == NULL)) {					\
 		CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n",	   \
 		       (int)(size));					  \
@@ -671,9 +677,9 @@ do {									      \
 } while (0)
 
 # define OBD_VMALLOC(ptr, size)						      \
-	 __OBD_VMALLOC_VEROBSE(ptr, NULL, 0, size)
+	 __OBD_VMALLOC_VERBOSE(ptr, NULL, 0, size)
 # define OBD_CPT_VMALLOC(ptr, cptab, cpt, size)				      \
-	 __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)
+	 __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)
 
 
 /* Allocations above this size are considered too big and could not be done
-- 
2.1.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mm: Export __vmalloc_node
  2015-02-02  3:10 ` [PATCH 1/2] mm: Export __vmalloc_node green
@ 2015-02-02 17:45   ` David Rientjes
  2015-02-02 20:31     ` Oleg Drokin
  0 siblings, 1 reply; 7+ messages in thread
From: David Rientjes @ 2015-02-02 17:45 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: Andrew Morton, linux-mm

On Sun, 1 Feb 2015, green@linuxhacker.ru wrote:

> From: Oleg Drokin <green@linuxhacker.ru>
> 
> vzalloc_node helpfully suggests to use __vmalloc_node if a more tight
> control over allocation flags is needed, but in fact __vmalloc_node
> is not only not exported, it's also static, so could not be used
> outside of mm/vmalloc.c
> Make it to be available as it was apparently intended.
> 

__vmalloc_node() is for the generalized functionality that is needed for 
the vmalloc API and not part of the API itself.  I think what you want to 
do is add a vmalloc_node_gfp(), or more specifically a vzalloc_node_gfp(), 
to do GFP_NOFS when needed.

> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
> ---
>  include/linux/vmalloc.h |  3 +++
>  mm/vmalloc.c            | 10 ++++------
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
> index b87696f..7eb2c46 100644
> --- a/include/linux/vmalloc.h
> +++ b/include/linux/vmalloc.h
> @@ -73,6 +73,9 @@ extern void *vmalloc_exec(unsigned long size);
>  extern void *vmalloc_32(unsigned long size);
>  extern void *vmalloc_32_user(unsigned long size);
>  extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
> +extern void *__vmalloc_node(unsigned long size, unsigned long align,
> +			    gfp_t gfp_mask, pgprot_t prot, int node,
> +			    const void *caller);
>  extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
>  			unsigned long start, unsigned long end, gfp_t gfp_mask,
>  			pgprot_t prot, int node, const void *caller);
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 39c3388..b882d95 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1552,9 +1552,6 @@ void *vmap(struct page **pages, unsigned int count,
>  }
>  EXPORT_SYMBOL(vmap);
>  
> -static void *__vmalloc_node(unsigned long size, unsigned long align,
> -			    gfp_t gfp_mask, pgprot_t prot,
> -			    int node, const void *caller);
>  static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>  				 pgprot_t prot, int node)
>  {
> @@ -1685,13 +1682,14 @@ fail:
>   *	allocator with @gfp_mask flags.  Map them into contiguous
>   *	kernel virtual space, using a pagetable protection of @prot.
>   */
> -static void *__vmalloc_node(unsigned long size, unsigned long align,
> -			    gfp_t gfp_mask, pgprot_t prot,
> -			    int node, const void *caller)
> +void *__vmalloc_node(unsigned long size, unsigned long align,
> +		     gfp_t gfp_mask, pgprot_t prot, int node,
> +		     const void *caller)
>  {
>  	return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
>  				gfp_mask, prot, node, caller);
>  }
> +EXPORT_SYMBOL(__vmalloc_node);
>  
>  void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
>  {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default
  2015-02-02  3:10 ` [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default green
@ 2015-02-02 17:48   ` David Rientjes
  2015-02-02 23:26     ` Oleg Drokin
  0 siblings, 1 reply; 7+ messages in thread
From: David Rientjes @ 2015-02-02 17:48 UTC (permalink / raw)
  To: green; +Cc: Andrew Morton, linux-mm, Bruno Faccini, Oleg Drokin

On Sun, 1 Feb 2015, green@linuxhacker.ru wrote:

> From: Bruno Faccini <bruno.faccini@intel.com>
> 
> When possible, try to use of __vmalloc_node() instead of
> vzalloc/vzalloc_node which allows for protection flag specification,
> and particularly to not set __GFP_FS, which can cause some deadlock
> situations in our code due to recursive calls.
> 

You're saying that all usage of OBD_ALLOC_LARGE() and 
OBD_CPT_ALLOC_LARGE() are in contexts where we need GFP_NOFS?  It would be 
much better to keep using vzalloc{,_node)() in contexts that permit 
__GFP_FS for a higher likelihood of being able to allocate the memory.

> Additionally fixed a typo in the macro name: VEROBSE->VERBOSE
> 
> Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
> Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
> Reviewed-on: http://review.whamcloud.com/11190
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5349
> ---
>  drivers/staging/lustre/lustre/include/obd_support.h | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
> index 2991d2e..c90a88e 100644
> --- a/drivers/staging/lustre/lustre/include/obd_support.h
> +++ b/drivers/staging/lustre/lustre/include/obd_support.h
> @@ -655,11 +655,17 @@ do {									      \
>  #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
>  	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
>  
> -# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)			      \
> +/* Direct use of __vmalloc_node() allows for protection flag specification
> + * (and particularly to not set __GFP_FS, which is likely to cause some
> + * deadlock situations in our code).
> + */
> +# define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)			      \
>  do {									      \
> -	(ptr) = cptab == NULL ?						      \
> -		vzalloc(size) :						      \
> -		vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt));	      \
> +	(ptr) = __vmalloc_node(size, 1, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,\
> +			       PAGE_KERNEL,				      \
> +			       cptab == NULL ? NUMA_NO_NODE :		      \
> +					      cfs_cpt_spread_node(cptab, cpt),\
> +			       __builtin_return_address(0));		      \
>  	if (unlikely((ptr) == NULL)) {					\
>  		CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n",	   \
>  		       (int)(size));					  \
> @@ -671,9 +677,9 @@ do {									      \
>  } while (0)
>  
>  # define OBD_VMALLOC(ptr, size)						      \
> -	 __OBD_VMALLOC_VEROBSE(ptr, NULL, 0, size)
> +	 __OBD_VMALLOC_VERBOSE(ptr, NULL, 0, size)
>  # define OBD_CPT_VMALLOC(ptr, cptab, cpt, size)				      \
> -	 __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)
> +	 __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)
>  
>  
>  /* Allocations above this size are considered too big and could not be done

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mm: Export __vmalloc_node
  2015-02-02 17:45   ` David Rientjes
@ 2015-02-02 20:31     ` Oleg Drokin
  0 siblings, 0 replies; 7+ messages in thread
From: Oleg Drokin @ 2015-02-02 20:31 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-mm

Hello!

On Feb 2, 2015, at 12:45 PM, David Rientjes wrote:

> On Sun, 1 Feb 2015, green@linuxhacker.ru wrote:
> 
>> From: Oleg Drokin <green@linuxhacker.ru>
>> 
>> vzalloc_node helpfully suggests to use __vmalloc_node if a more tight
>> control over allocation flags is needed, but in fact __vmalloc_node
>> is not only not exported, it's also static, so could not be used
>> outside of mm/vmalloc.c
>> Make it to be available as it was apparently intended.
>> 
> 
> __vmalloc_node() is for the generalized functionality that is needed for 
> the vmalloc API and not part of the API itself.  I think what you want to 
> do is add a vmalloc_node_gfp(), or more specifically a vzalloc_node_gfp(), 
> to do GFP_NOFS when needed.

So, the comment for the vzalloc_node reads:
 * For tight control over page level allocator and protection flags
 * use __vmalloc_node() instead.
 */
void *vzalloc_node(unsigned long size, int node)

Very similar to the comment for vzalloc:
 *      For tight control over page level allocator and protection flags
 *      use __vmalloc() instead.
 */
void *vzalloc(unsigned long size)

__vmalloc is exported and is allowed to be used everywhere.

Should we then just take down the __vmalloc_node comment near vzalloc_node
to no longer confuse people?

> 
>> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
>> ---
>> include/linux/vmalloc.h |  3 +++
>> mm/vmalloc.c            | 10 ++++------
>> 2 files changed, 7 insertions(+), 6 deletions(-)
>> 
>> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
>> index b87696f..7eb2c46 100644
>> --- a/include/linux/vmalloc.h
>> +++ b/include/linux/vmalloc.h
>> @@ -73,6 +73,9 @@ extern void *vmalloc_exec(unsigned long size);
>> extern void *vmalloc_32(unsigned long size);
>> extern void *vmalloc_32_user(unsigned long size);
>> extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
>> +extern void *__vmalloc_node(unsigned long size, unsigned long align,
>> +			    gfp_t gfp_mask, pgprot_t prot, int node,
>> +			    const void *caller);
>> extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
>> 			unsigned long start, unsigned long end, gfp_t gfp_mask,
>> 			pgprot_t prot, int node, const void *caller);
>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>> index 39c3388..b882d95 100644
>> --- a/mm/vmalloc.c
>> +++ b/mm/vmalloc.c
>> @@ -1552,9 +1552,6 @@ void *vmap(struct page **pages, unsigned int count,
>> }
>> EXPORT_SYMBOL(vmap);
>> 
>> -static void *__vmalloc_node(unsigned long size, unsigned long align,
>> -			    gfp_t gfp_mask, pgprot_t prot,
>> -			    int node, const void *caller);
>> static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>> 				 pgprot_t prot, int node)
>> {
>> @@ -1685,13 +1682,14 @@ fail:
>>  *	allocator with @gfp_mask flags.  Map them into contiguous
>>  *	kernel virtual space, using a pagetable protection of @prot.
>>  */
>> -static void *__vmalloc_node(unsigned long size, unsigned long align,
>> -			    gfp_t gfp_mask, pgprot_t prot,
>> -			    int node, const void *caller)
>> +void *__vmalloc_node(unsigned long size, unsigned long align,
>> +		     gfp_t gfp_mask, pgprot_t prot, int node,
>> +		     const void *caller)
>> {
>> 	return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
>> 				gfp_mask, prot, node, caller);
>> }
>> +EXPORT_SYMBOL(__vmalloc_node);
>> 
>> void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
>> {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default
  2015-02-02 17:48   ` David Rientjes
@ 2015-02-02 23:26     ` Oleg Drokin
  0 siblings, 0 replies; 7+ messages in thread
From: Oleg Drokin @ 2015-02-02 23:26 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-mm, Bruno Faccini


On Feb 2, 2015, at 12:48 PM, David Rientjes wrote:

> On Sun, 1 Feb 2015, green@linuxhacker.ru wrote:
> 
>> From: Bruno Faccini <bruno.faccini@intel.com>
>> 
>> When possible, try to use of __vmalloc_node() instead of
>> vzalloc/vzalloc_node which allows for protection flag specification,
>> and particularly to not set __GFP_FS, which can cause some deadlock
>> situations in our code due to recursive calls.
> You're saying that all usage of OBD_ALLOC_LARGE() and 
> OBD_CPT_ALLOC_LARGE() are in contexts where we need GFP_NOFS?  It would be 

Most of them fore sure (hm, there's only one OBD_CPT_ALLOC_LARGE in the client
and I imagine it better be GFP_NOFS even though the condition for that is
very unlikely, but that's what happens when you have tens of thousands nodes
all doing the same code all the time - all sorts of unlikely things trigger a lot).

> much better to keep using vzalloc{,_node)() in contexts that permit 
> __GFP_FS for a higher likelihood of being able to allocate the memory.

While it's certainly possible to go audit all the OBD_ALLOC_LARGE and
isolate the ones where __GFP_FS is not detrimential, I just found yesterday that
vmalloc possibly does GFP_KERNEL allocations in its guts no matter what.
I saw all the rants and stuff about that too (but somewhat old).
Yet I cannot help but ask too if perhaps something could be done about it now?

> 
>> Additionally fixed a typo in the macro name: VEROBSE->VERBOSE
>> 
>> Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
>> Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
>> Reviewed-on: http://review.whamcloud.com/11190
>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5349
>> ---
>> drivers/staging/lustre/lustre/include/obd_support.h | 18 ++++++++++++------
>> 1 file changed, 12 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
>> index 2991d2e..c90a88e 100644
>> --- a/drivers/staging/lustre/lustre/include/obd_support.h
>> +++ b/drivers/staging/lustre/lustre/include/obd_support.h
>> @@ -655,11 +655,17 @@ do {									      \
>> #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
>> 	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
>> 
>> -# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)			      \
>> +/* Direct use of __vmalloc_node() allows for protection flag specification
>> + * (and particularly to not set __GFP_FS, which is likely to cause some
>> + * deadlock situations in our code).
>> + */
>> +# define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)			      \
>> do {									      \
>> -	(ptr) = cptab == NULL ?						      \
>> -		vzalloc(size) :						      \
>> -		vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt));	      \
>> +	(ptr) = __vmalloc_node(size, 1, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,\
>> +			       PAGE_KERNEL,				      \
>> +			       cptab == NULL ? NUMA_NO_NODE :		      \
>> +					      cfs_cpt_spread_node(cptab, cpt),\
>> +			       __builtin_return_address(0));		      \
>> 	if (unlikely((ptr) == NULL)) {					\
>> 		CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n",	   \
>> 		       (int)(size));					  \
>> @@ -671,9 +677,9 @@ do {									      \
>> } while (0)
>> 
>> # define OBD_VMALLOC(ptr, size)						      \
>> -	 __OBD_VMALLOC_VEROBSE(ptr, NULL, 0, size)
>> +	 __OBD_VMALLOC_VERBOSE(ptr, NULL, 0, size)
>> # define OBD_CPT_VMALLOC(ptr, cptab, cpt, size)				      \
>> -	 __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)
>> +	 __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)
>> 
>> 
>> /* Allocations above this size are considered too big and could not be done

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-02 23:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-02  3:10 [PATCH 0/2] Export __vmalloc_node symbol green
2015-02-02  3:10 ` [PATCH 1/2] mm: Export __vmalloc_node green
2015-02-02 17:45   ` David Rientjes
2015-02-02 20:31     ` Oleg Drokin
2015-02-02  3:10 ` [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default green
2015-02-02 17:48   ` David Rientjes
2015-02-02 23:26     ` Oleg Drokin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.