Re: [PATCH] mm: Optimize put_mems_allowed() usage

From: Peter Zijlstra
Date: Thu May 17 2012 - 16:23:41 EST


On Thu, 2012-05-17 at 13:16 -0700, Andrew Morton wrote:
> I do think it was a bad idea to remove that comment. As it stands, the
> reader will be wondering why we did the read_mems_allowed_begin() at
> all, and whether failing to check for a change is a bug.
>
> --- a/mm/slub.c~mm-optimize-put_mems_allowed-usage-fix
> +++ a/mm/slub.c
> @@ -1624,8 +1624,16 @@ static struct page *get_any_partial(stru
> if (n && cpuset_zone_allowed_hardwall(zone, flags) &&
> n->nr_partial > s->min_partial) {
> object = get_partial_node(s, n, c);
> - if (object)
> + if (object) {
> + /*
> + * Don't check read_mems_allowed_retry()
> + * here - if mems_allowed was updated in
> + * parallel, that was a harmless race
> + * between allocation and the cpuset
> + * update
> + */
> return object;
> + }
> }
> }
> } while (read_mems_allowed_retry(cpuset_mems_cookie));

OK, it seemed weird to have that comment in this one place whilst it is
the general pattern of this construct.

The whole read_mems_allowed_retry() should only ever be attempted in
case the allocation failed.

But sure..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/