linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Bruno Faccini <bruno.faccini@intel.com>
Subject: Re: [PATCH 2/2] staging/lustre: use __vmalloc_node() to avoid __GFP_FS default
Date: Mon, 2 Feb 2015 18:26:53 -0500	[thread overview]
Message-ID: <7C13E0D6-CFBD-4F32-8F66-B96A8D427E1A@linuxhacker.ru> (raw)
In-Reply-To: <alpine.DEB.2.10.1502020945370.5117@chino.kir.corp.google.com>


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>

      reply	other threads:[~2015-02-02 23:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C13E0D6-CFBD-4F32-8F66-B96A8D427E1A@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=akpm@linux-foundation.org \
    --cc=bruno.faccini@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox