diff options
author | Michal Hocko <mhocko@suse.cz> | 2015-04-14 18:47:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:04 -0400 |
commit | f91e8d6d76866eafba255864ca617438cec268de (patch) | |
tree | e3e18550b6cd7d110c187c8e5947be11c99fcd55 /arch | |
parent | 647757197cd34fae041e21af39ded00f5c346fc4 (diff) |
sparc: clarify __GFP_NOFAIL allocation
Commit 920c3ed74134 ("[SPARC64]: Add basic infrastructure for MD
add/remove notification") has added __GFP_NOFAIL for the allocation
request but it hasn't mentioned why is this strict requirement really
needed. The code was handling an allocation failure and propagated it
properly up the callchain so it is not clear why it is needed.
Dave has clarified the intention when I tried to remove the flag as not
being necessary:
: It is a serious failure.
:
: If we miss an MDESC update due to this allocation failure, the update
: is not an event which gets retransmitted so we will lose the updated
: machine description forever.
:
: We really need this allocation to succeed.
So add a comment to clarify the nofail flag and get rid of the failure
check because __GFP_NOFAIL allocation doesn't fail.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Vipul Pandya <vipul@chelsio.com>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/mdesc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 99632a87e697..26c80e18d7b1 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c | |||
@@ -130,26 +130,26 @@ static struct mdesc_mem_ops memblock_mdesc_ops = { | |||
130 | static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) | 130 | static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) |
131 | { | 131 | { |
132 | unsigned int handle_size; | 132 | unsigned int handle_size; |
133 | struct mdesc_handle *hp; | ||
134 | unsigned long addr; | ||
133 | void *base; | 135 | void *base; |
134 | 136 | ||
135 | handle_size = (sizeof(struct mdesc_handle) - | 137 | handle_size = (sizeof(struct mdesc_handle) - |
136 | sizeof(struct mdesc_hdr) + | 138 | sizeof(struct mdesc_hdr) + |
137 | mdesc_size); | 139 | mdesc_size); |
138 | 140 | ||
141 | /* | ||
142 | * Allocation has to succeed because mdesc update would be missed | ||
143 | * and such events are not retransmitted. | ||
144 | */ | ||
139 | base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL); | 145 | base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL); |
140 | if (base) { | 146 | addr = (unsigned long)base; |
141 | struct mdesc_handle *hp; | 147 | addr = (addr + 15UL) & ~15UL; |
142 | unsigned long addr; | 148 | hp = (struct mdesc_handle *) addr; |
143 | |||
144 | addr = (unsigned long)base; | ||
145 | addr = (addr + 15UL) & ~15UL; | ||
146 | hp = (struct mdesc_handle *) addr; | ||
147 | 149 | ||
148 | mdesc_handle_init(hp, handle_size, base); | 150 | mdesc_handle_init(hp, handle_size, base); |
149 | return hp; | ||
150 | } | ||
151 | 151 | ||
152 | return NULL; | 152 | return hp; |
153 | } | 153 | } |
154 | 154 | ||
155 | static void mdesc_kfree(struct mdesc_handle *hp) | 155 | static void mdesc_kfree(struct mdesc_handle *hp) |