From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756240AbdGLCWq (ORCPT ); Tue, 11 Jul 2017 22:22:46 -0400 Received: from mga05.intel.com ([192.55.52.43]:1340 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbdGLCWp (ORCPT ); Tue, 11 Jul 2017 22:22:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,347,1496127600"; d="scan'208";a="126025331" From: "Huang\, Ying" To: Dave Hansen Cc: "Huang\, Ying" , Andrew Morton , , , Minchan Kim , Rik van Riel , Shaohua Li , Hugh Dickins , Fengguang Wu , Tim Chen Subject: Re: [PATCH -mm -v2 2/6] mm, swap: Add swap readahead hit statistics References: <20170630014443.23983-1-ying.huang@intel.com> <20170630014443.23983-3-ying.huang@intel.com> <1152d4f5-fe8b-b46c-9d6b-3ecf69019172@intel.com> Date: Wed, 12 Jul 2017 10:22:42 +0800 In-Reply-To: <1152d4f5-fe8b-b46c-9d6b-3ecf69019172@intel.com> (Dave Hansen's message of "Tue, 11 Jul 2017 11:25:36 -0700") Message-ID: <87shi24cnh.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dave Hansen writes: > On 06/29/2017 06:44 PM, Huang, Ying wrote: >> >> static atomic_t swapin_readahead_hits = ATOMIC_INIT(4); >> +static atomic_long_t swapin_readahead_hits_total = ATOMIC_INIT(0); >> +static atomic_long_t swapin_readahead_total = ATOMIC_INIT(0); >> >> void show_swap_cache_info(void) >> { >> @@ -305,8 +307,10 @@ struct page * lookup_swap_cache(swp_entry_t entry) >> >> if (page && likely(!PageTransCompound(page))) { >> INC_CACHE_INFO(find_success); >> - if (TestClearPageReadahead(page)) >> + if (TestClearPageReadahead(page)) { >> atomic_inc(&swapin_readahead_hits); >> + atomic_long_inc(&swapin_readahead_hits_total); >> + } >> } > > Adding global atomics that we touch in hot paths seems like poor > future-proofing. Are we sure we want to do this and not use some of the > nice, fancy, percpu counters that we have? Yes. It is much better to use percpu counters instead. Will change it in the next version. Best Regards, Huang, Ying