From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933207AbdCaO7P (ORCPT ); Fri, 31 Mar 2017 10:59:15 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:43090 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754884AbdCaO7N (ORCPT ); Fri, 31 Mar 2017 10:59:13 -0400 Date: Fri, 31 Mar 2017 10:59:06 -0400 From: Johannes Weiner To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , "Kirill A . Shutemov" , Vladimir Davydov , Michal Hocko , Tejun Heo , cgroups@vger.kernel.org Subject: Re: [PATCH -mm -v7 2/9] mm, memcg: Support to charge/uncharge multiple swap entries Message-ID: <20170331145906.GC6408@cmpxchg.org> References: <20170328053209.25876-1-ying.huang@intel.com> <20170328053209.25876-3-ying.huang@intel.com> <20170329165722.GB31821@cmpxchg.org> <87k277twip.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k277twip.fsf@yhuang-dev.intel.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 30, 2017 at 08:53:50AM +0800, Huang, Ying wrote: > Johannes Weiner writes: > > but there doesn't seem to be a reason to > > pass @nr_entries when we have the struct page. Why can't this function > > just check PageTransHuge() by itself? > > Because sometimes we need to charge one swap entry for a THP. Please > take a look at the original add_to_swap() implementation. For a THP, > one swap entry will be allocated and charged to the mem cgroup before > the THP is split. And I think it is not easy to change this, because we > don't want to split THP if the mem cgroup for swap exceeds its limit. I think we do. Let's continue this discussion in the 9/9 subthread.