Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753684AbbHXBEH (ORCPT ); Sun, 23 Aug 2015 21:04:07 -0400 Received: from ns.horizon.com ([71.41.210.147]:62974 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751881AbbHXBEG (ORCPT ); Sun, 23 Aug 2015 21:04:06 -0400 Date: 23 Aug 2015 21:04:03 -0400 Message-ID: <20150824010403.27903.qmail@ns.horizon.com> From: "George Spelvin" To: linux@horizon.com, mingo@kernel.org Subject: Re: [PATCH 3/3 v3] mm/vmalloc: Cache the vmalloc memory info Cc: dave@sr71.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux@rasmusvillemoes.dk, peterz@infradead.org, riel@redhat.com, rientjes@google.com, torvalds@linux-foundation.org In-Reply-To: <20150823081750.GA28349@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1432 Lines: 34 First, an actual, albeit minor, bug: initializing both vmap_info_gen and vmap_info_cache_gen to 0 marks the cache as valid, which it's not. vmap_info_gen should be initialized to 1 to force an initial cache update. Second, I don't see why you need a 64-bit counter. Seqlocks consider 32 bits (31 bits, actually, the lsbit means "update in progress") quite a strong enough guarantee. Third, it seems as though vmap_info_cache_gen is basically a duplicate of vmap_info_lock.sequence. It should be possible to make one variable serve both purposes. You just need a kludge to handle the case of multiple vamp_info updates between cache updates. There are two simple ones: 1) Avoid bumping vmap_info_gen unnecessarily. In vmap_unlock(), do vmap_info_gen = (vmap_info_lock.sequence | 1) + 1; 2) - Make vmap_info_gen a seqcount_t - In vmap_unlock(), do write_seqcount_barrier(&vmap_info_gen) - In get_vmalloc_info, inside the seqlock critical section, do vmap_info_lock.seqcount.sequence = vmap_info_gen.sequence - 1; (Using the vmap_info_gen.sequence read while validating the cache in the first place.) I should try to write an actual patch illustrating this. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/