Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956Ab3DZP3I (ORCPT ); Fri, 26 Apr 2013 11:29:08 -0400 Received: from mga14.intel.com ([143.182.124.37]:48987 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756516Ab3DZP3G (ORCPT ); Fri, 26 Apr 2013 11:29:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,559,1363158000"; d="scan'208";a="293646067" From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , Andrea Arcangeli , Andrew Morton , Al Viro , Hugh Dickins , Wu Fengguang , Jan Kara , Mel Gorman , linux-mm@kvack.org, Andi Kleen , Matthew Wilcox , "Kirill A. Shutemov" , Hillf Danton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <5163155D.7030401@sr71.net> References: <1365163198-29726-1-git-send-email-kirill.shutemov@linux.intel.com> <1365163198-29726-33-git-send-email-kirill.shutemov@linux.intel.com> <5163155D.7030401@sr71.net> Subject: Re: [PATCHv3, RFC 32/34] thp: handle write-protect exception to file-backed huge pages Content-Transfer-Encoding: 7bit Message-Id: <20130426153104.92450E0085@blue.fi.intel.com> Date: Fri, 26 Apr 2013 18:31:04 +0300 (EEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 766 Lines: 22 Dave Hansen wrote: > > + if (!PageAnon(page)) { > > + add_mm_counter(mm, MM_FILEPAGES, -HPAGE_PMD_NR); > > + add_mm_counter(mm, MM_ANONPAGES, HPAGE_PMD_NR); > > + } > > This seems like a bit of a hack. Shouldn't we have just been accounting > to MM_FILEPAGES in the first place? No, it's not. It handles MAP_PRIVATE file mappings. The page was read first and accounted to MM_FILEPAGES and then COW'ed by anon page here, so we have to adjust counters. do_wp_page() has similar code. -- Kirill A. Shutemov -- 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/