Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1561151 > unrolled thread
| Started by | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| First post | 2017-01-18 01:10 +0100 |
| Last post | 2017-01-18 10:50 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Vlastimil Babka <vbabka@suse.cz> - 2017-01-18 01:10 +0100
Re: [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Michal Hocko <mhocko@kernel.org> - 2017-01-18 10:40 +0100
Re: [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Vlastimil Babka <vbabka@suse.cz> - 2017-01-18 10:50 +0100
Re: [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Michal Hocko <mhocko@kernel.org> - 2017-01-18 11:20 +0100
Re: [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Mel Gorman <mgorman@techsingularity.net> - 2017-01-18 10:50 +0100
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2017-01-18 01:10 +0100 |
| Subject | [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone |
| Message-ID | <t0LZ8-5nf-31@gated-at.bofh.it> |
Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in
a zonelist twice") we have a wrong check for NULL preferred_zone, which can
theoretically happen due to concurrent cpuset modification. We check the
zoneref pointer which is never NULL and we should check the zone pointer.
Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice")
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 34ada718ef47..593a11d8bc6b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3763,7 +3763,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
*/
ac.preferred_zoneref = first_zones_zonelist(ac.zonelist,
ac.high_zoneidx, ac.nodemask);
- if (!ac.preferred_zoneref) {
+ if (!ac.preferred_zoneref->zone) {
page = NULL;
goto no_zone;
}
--
2.11.0
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-18 10:40 +0100 |
| Message-ID | <t0USK-2fJ-33@gated-at.bofh.it> |
| In reply to | #1561151 |
On Tue 17-01-17 23:16:07, Vlastimil Babka wrote:
> Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in
> a zonelist twice") we have a wrong check for NULL preferred_zone, which can
> theoretically happen due to concurrent cpuset modification. We check the
> zoneref pointer which is never NULL and we should check the zone pointer.
>
> Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice")
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 34ada718ef47..593a11d8bc6b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3763,7 +3763,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
> */
> ac.preferred_zoneref = first_zones_zonelist(ac.zonelist,
> ac.high_zoneidx, ac.nodemask);
> - if (!ac.preferred_zoneref) {
> + if (!ac.preferred_zoneref->zone) {
When can the ->zone be NULL?
> page = NULL;
> goto no_zone;
> }
> --
> 2.11.0
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2017-01-18 10:50 +0100 |
| Message-ID | <t0V2r-2ja-43@gated-at.bofh.it> |
| In reply to | #1561397 |
On 01/18/2017 10:31 AM, Michal Hocko wrote:
> On Tue 17-01-17 23:16:07, Vlastimil Babka wrote:
>> Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in
>> a zonelist twice") we have a wrong check for NULL preferred_zone, which can
>> theoretically happen due to concurrent cpuset modification. We check the
>> zoneref pointer which is never NULL and we should check the zone pointer.
>>
>> Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice")
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> ---
>> mm/page_alloc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 34ada718ef47..593a11d8bc6b 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -3763,7 +3763,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
>> */
>> ac.preferred_zoneref = first_zones_zonelist(ac.zonelist,
>> ac.high_zoneidx, ac.nodemask);
>> - if (!ac.preferred_zoneref) {
>> + if (!ac.preferred_zoneref->zone) {
>
> When can the ->zone be NULL?
Either we get a genuinely screwed nodemask, or there's a concurrent cpuset
update and nodes in zonelist are ordered in such a way that we see all of them
as not being available to us in the nodemask/current->mems_alowed, when we
iterate the zonelist, so we reach the end of zonelist. The zonelists are
terminated with a zoneref with NULL zone pointer.
>
>> page = NULL;
>> goto no_zone;
>> }
>> --
>> 2.11.0
>
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-18 11:20 +0100 |
| Message-ID | <t0Vvt-2I0-33@gated-at.bofh.it> |
| In reply to | #1561416 |
On Wed 18-01-17 10:45:33, Vlastimil Babka wrote:
> On 01/18/2017 10:31 AM, Michal Hocko wrote:
> > On Tue 17-01-17 23:16:07, Vlastimil Babka wrote:
> > > Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in
> > > a zonelist twice") we have a wrong check for NULL preferred_zone, which can
> > > theoretically happen due to concurrent cpuset modification. We check the
> > > zoneref pointer which is never NULL and we should check the zone pointer.
> > >
> > > Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice")
> > > Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> > > ---
> > > mm/page_alloc.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 34ada718ef47..593a11d8bc6b 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -3763,7 +3763,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
> > > */
> > > ac.preferred_zoneref = first_zones_zonelist(ac.zonelist,
> > > ac.high_zoneidx, ac.nodemask);
> > > - if (!ac.preferred_zoneref) {
> > > + if (!ac.preferred_zoneref->zone) {
> >
> > When can the ->zone be NULL?
>
> Either we get a genuinely screwed nodemask, or there's a concurrent cpuset
> update and nodes in zonelist are ordered in such a way that we see all of
> them as not being available to us in the nodemask/current->mems_alowed, when
> we iterate the zonelist, so we reach the end of zonelist. The zonelists are
> terminated with a zoneref with NULL zone pointer.
Thanks for the clarification. Please add a big fat comment in
first_zones_zonelist about this potential case.
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-18 10:50 +0100 |
| Message-ID | <t0V2q-2ja-21@gated-at.bofh.it> |
| In reply to | #1561151 |
On Tue, Jan 17, 2017 at 11:16:07PM +0100, Vlastimil Babka wrote:
> Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in
> a zonelist twice") we have a wrong check for NULL preferred_zone, which can
> theoretically happen due to concurrent cpuset modification. We check the
> zoneref pointer which is never NULL and we should check the zone pointer.
>
> Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice")
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
--
Mel Gorman
SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web