[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150823064603.14050.qmail@ns.horizon.com>
Date: 23 Aug 2015 02:46:03 -0400
From: "George Spelvin" <linux@...izon.com>
To: linux@...izon.com, mingo@...nel.org
Cc: dave@...1.net, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux@...musvillemoes.dk, peterz@...radead.org, riel@...hat.com,
rientjes@...gle.com, torvalds@...ux-foundation.org
Subject: Re: [PATCH 0/3] mm/vmalloc: Cache the /proc/meminfo vmalloc statistics
Ingo Molnar <mingo@...nel.org> wrote:
> I think this is too complex.
>
> How about something simple like the patch below (on top of the third patch)?
> It makes the vmalloc info transactional - /proc/meminfo will always print a
> consistent set of numbers. (Not that we really care about races there, but it
> looks really simple to solve so why not.)
Looks like a huge simplification!
It needs a comment about the approximate nature of the locking and
the obvious race conditions:
1) The first caller to get_vmalloc_info() clears vmap_info_changed
before updating vmap_info_cache, so a second caller is likely to
get stale data for the duration of a calc_vmalloc_info call.
2) Although unlikely, it's possible for two threads to race calling
calc_vmalloc_info, and the one that computes fresher data updates
the cache first, so the later write leaves stale data.
Other issues:
3) Me, I'd make vmap_info_changed a bool, for documentation more than
any space saving.
4) I wish there were a trylock version of write_seqlock, so we could
avoid blocking entirely. (You *could* hand-roll it, but that eats
into the simplicity.)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists