Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1343103 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2016-02-25 11:50 +0100 |
| Last post | 2016-02-25 14:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: remove __GFP_NOFAIL is deprecated comment Michal Hocko <mhocko@kernel.org> - 2016-02-25 11:50 +0100
Re: [PATCH] mm: remove __GFP_NOFAIL is deprecated comment Nikolay Borisov <kernel@kyup.com> - 2016-02-25 12:40 +0100
Re: [PATCH] mm: remove __GFP_NOFAIL is deprecated comment Michal Hocko <mhocko@kernel.org> - 2016-02-25 14:50 +0100
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-02-25 11:50 +0100 |
| Subject | [PATCH] mm: remove __GFP_NOFAIL is deprecated comment |
| Message-ID | <r61EC-2xk-9@gated-at.bofh.it> |
From: Michal Hocko <mhocko@suse.com>
647757197cd3 ("mm: clarify __GFP_NOFAIL deprecation status") was
incomplete and didn't remove the comment about __GFP_NOFAIL being
deprecated in buffered_rmqueue. Let's get rid of this leftover
but keep the WARN_ON_ONCE for order > 1 because we should really
discourage from using __GFP_NOFAIL with higher order allocations
because those are just too subtle.
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
Hi,
this popped out when discussing another patch http://lkml.kernel.org/r/56CEC568.6080809@kyup.com
so I think it is worth removing the comment.
mm/page_alloc.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1993894b4219..109d975a7172 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2347,19 +2347,11 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
list_del(&page->lru);
pcp->count--;
} else {
- if (unlikely(gfp_flags & __GFP_NOFAIL)) {
- /*
- * __GFP_NOFAIL is not to be used in new code.
- *
- * All __GFP_NOFAIL callers should be fixed so that they
- * properly detect and handle allocation failures.
- *
- * We most definitely don't want callers attempting to
- * allocate greater than order-1 page units with
- * __GFP_NOFAIL.
- */
- WARN_ON_ONCE(order > 1);
- }
+ /*
+ * We most definitely don't want callers attempting to
+ * allocate greater than order-1 page units with __GFP_NOFAIL.
+ */
+ WARN_ON_ONCE(unlikely(gfp_flags & __GFP_NOFAIL) && (order > 1));
spin_lock_irqsave(&zone->lock, flags);
page = NULL;
--
2.7.0
[toc] | [next] | [standalone]
| From | Nikolay Borisov <kernel@kyup.com> |
|---|---|
| Date | 2016-02-25 12:40 +0100 |
| Message-ID | <r62qZ-37z-1@gated-at.bofh.it> |
| In reply to | #1343103 |
On 02/25/2016 12:43 PM, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> 647757197cd3 ("mm: clarify __GFP_NOFAIL deprecation status") was
> incomplete and didn't remove the comment about __GFP_NOFAIL being
> deprecated in buffered_rmqueue. Let's get rid of this leftover
> but keep the WARN_ON_ONCE for order > 1 because we should really
> discourage from using __GFP_NOFAIL with higher order allocations
> because those are just too subtle.
>
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> this popped out when discussing another patch http://lkml.kernel.org/r/56CEC568.6080809@kyup.com
> so I think it is worth removing the comment.
>
> mm/page_alloc.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 1993894b4219..109d975a7172 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2347,19 +2347,11 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
> list_del(&page->lru);
> pcp->count--;
> } else {
> - if (unlikely(gfp_flags & __GFP_NOFAIL)) {
> - /*
> - * __GFP_NOFAIL is not to be used in new code.
> - *
> - * All __GFP_NOFAIL callers should be fixed so that they
> - * properly detect and handle allocation failures.
> - *
> - * We most definitely don't want callers attempting to
> - * allocate greater than order-1 page units with
> - * __GFP_NOFAIL.
> - */
> - WARN_ON_ONCE(order > 1);
> - }
> + /*
> + * We most definitely don't want callers attempting to
> + * allocate greater than order-1 page units with __GFP_NOFAIL.
> + */
> + WARN_ON_ONCE(unlikely(gfp_flags & __GFP_NOFAIL) && (order > 1));
WARN_ON_ONCE already includes an unlikely in its definition:
http://lxr.free-electrons.com/source/include/asm-generic/bug.h#L109
> spin_lock_irqsave(&zone->lock, flags);
>
> page = NULL;
>
Reviewed-by: Nikolay Borisov <kernel@kyup.com>
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-02-25 14:50 +0100 |
| Message-ID | <r64sQ-4uZ-21@gated-at.bofh.it> |
| In reply to | #1343122 |
On Thu 25-02-16 13:36:11, Nikolay Borisov wrote:
[...]
> > + /*
> > + * We most definitely don't want callers attempting to
> > + * allocate greater than order-1 page units with __GFP_NOFAIL.
> > + */
> > + WARN_ON_ONCE(unlikely(gfp_flags & __GFP_NOFAIL) && (order > 1));
>
> WARN_ON_ONCE already includes an unlikely in its definition:
> http://lxr.free-electrons.com/source/include/asm-generic/bug.h#L109
OK, I just wanted to keep the condition untouched but you are right the
unlikely can be removed.
> Reviewed-by: Nikolay Borisov <kernel@kyup.com>
Thanks!
---
From 6ddc73c6d659224e996d1060974f5a14a1c5bf7d Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.com>
Date: Thu, 25 Feb 2016 11:29:12 +0100
Subject: [PATCH] mm: remove __GFP_NOFAIL is deprecated comment
647757197cd3 ("mm: clarify __GFP_NOFAIL deprecation status") was
incomplete and didn't remove the comment about __GFP_NOFAIL being
deprecated in buffered_rmqueue. Let's get rid of this leftover
but keep the WARN_ON_ONCE for order > 1 because we should really
discourage from using __GFP_NOFAIL with higher order allocations
because those are just too subtle.
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Nikolay Borisov <kernel@kyup.com>
---
mm/page_alloc.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1993894b4219..b5b7a7b0cad0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2347,19 +2347,11 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
list_del(&page->lru);
pcp->count--;
} else {
- if (unlikely(gfp_flags & __GFP_NOFAIL)) {
- /*
- * __GFP_NOFAIL is not to be used in new code.
- *
- * All __GFP_NOFAIL callers should be fixed so that they
- * properly detect and handle allocation failures.
- *
- * We most definitely don't want callers attempting to
- * allocate greater than order-1 page units with
- * __GFP_NOFAIL.
- */
- WARN_ON_ONCE(order > 1);
- }
+ /*
+ * We most definitely don't want callers attempting to
+ * allocate greater than order-1 page units with __GFP_NOFAIL.
+ */
+ WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));
spin_lock_irqsave(&zone->lock, flags);
page = NULL;
--
2.7.0
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web