From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Weiner Subject: Re: [PATCH -mm -v7 2/9] mm, memcg: Support to charge/uncharge multiple swap entries Date: Fri, 31 Mar 2017 10:59:06 -0400 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 Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tO32wVMcjHnIiAKcMGypT+pqmueDQMNyi2KimB0JnPM=; b=e88wwFUwT8+6VNSR2h5vNFXXUO Z4y6cvQ/tmRIi12jaVniuoaGuLzRfYEgsFY0iA3zoCossMwpzaAbkHxkePao47u8jP+k4y47Gzazz zy7ap+RzERKaIn3vzU8BRJ+Nn4cWyU1/v8a7VuaGBtxjwM6BOo8P4Bj5G6dIeHF7Lxvg=; Content-Disposition: inline In-Reply-To: <87k277twip.fsf-5/hDr2MS57EDqwDYnZuMFFaTQe2KTcn/@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Huang, Ying" Cc: Andrew Morton , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andrea Arcangeli , "Kirill A . Shutemov" , Vladimir Davydov , Michal Hocko , Tejun Heo , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id ACC2A6B039F for ; Fri, 31 Mar 2017 10:59:12 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id z36so16499733wrc.14 for ; Fri, 31 Mar 2017 07:59:12 -0700 (PDT) Received: from gum.cmpxchg.org (gum.cmpxchg.org. [85.214.110.215]) by mx.google.com with ESMTPS id b190si3810298wmd.47.2017.03.31.07.59.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Mar 2017 07:59:11 -0700 (PDT) Date: Fri, 31 Mar 2017 10:59:06 -0400 From: Johannes Weiner 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> Sender: owner-linux-mm@kvack.org List-ID: 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 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org 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.