Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626900

Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From "Huang\, Ying" <ying.huang@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out
Date Thu, 20 Apr 2017 02:50:01 +0200
Message-ID <ty8sh-1SW-3@gated-at.bofh.it> (permalink)
References <txRUu-lm-9@gated-at.bofh.it> <txRUv-lm-33@gated-at.bofh.it> <ty0bo-5gm-1@gated-at.bofh.it>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.37,222,1488873600"; d="scan'208";a="1137892955"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version 1.0
Content-Type text/plain; charset=ascii
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 58
Organization linux.* mail to news gateway
X-Original-Cc "Huang\, Ying" <ying.huang@intel.com>, Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, Andrea Arcangeli <aarcange@redhat.com>, "Ebru Akagunduz" <ebru.akagunduz@gmail.com>, Michal Hocko <mhocko@kernel.org>, "Tejun Heo" <tj@kernel.org>, Hugh Dickins <hughd@google.com>, Shaohua Li <shli@kernel.org>, Minchan Kim <minchan@kernel.org>, Rik van Riel <riel@redhat.com>, <cgroups@vger.kernel.org>
X-Original-Date Thu, 20 Apr 2017 08:43:12 +0800
X-Original-Message-ID <87inlzrjrz.fsf@yhuang-dev.intel.com>
X-Original-References <20170419070625.19776-1-ying.huang@intel.com> <20170419070625.19776-2-ying.huang@intel.com> <20170419155252.GA3376@cmpxchg.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1626900

Show key headers only | View raw


Hi, Johannes,

Johannes Weiner <hannes@cmpxchg.org> writes:

> On Wed, Apr 19, 2017 at 03:06:23PM +0800, Huang, Ying wrote:
>> @@ -206,17 +212,34 @@ int add_to_swap(struct page *page, struct list_head *list)
>>  	 */
>>  	err = add_to_swap_cache(page, entry,
>>  			__GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN);
>> -
>> -	if (!err) {
>> -		return 1;
>> -	} else {	/* -ENOMEM radix-tree allocation failure */
>> +	/* -ENOMEM radix-tree allocation failure */
>> +	if (err)
>>  		/*
>>  		 * add_to_swap_cache() doesn't return -EEXIST, so we can safely
>>  		 * clear SWAP_HAS_CACHE flag.
>>  		 */
>> -		swapcache_free(entry);
>> -		return 0;
>> +		goto fail_free;
>> +
>> +	if (unlikely(PageTransHuge(page))) {
>> +		err = split_huge_page_to_list(page, list);
>> +		if (err) {
>> +			delete_from_swap_cache(page);
>> +			return 0;
>> +		}
>>  	}
>> +
>> +	return 1;
>> +
>> +fail_free:
>> +	if (unlikely(PageTransHuge(page)))
>> +		swapcache_free_cluster(entry);
>> +	else
>> +		swapcache_free(entry);
>> +fail:
>> +	if (unlikely(PageTransHuge(page)) &&
>> +	    !split_huge_page_to_list(page, list))
>> +		goto retry;
>
> May I ask why you added the unlikelies there? Can you generally say
> THPs are unlikely in this path? Is the swap-out path so hot that
> branch layout is critical? I doubt either is true.

I just found there are unlikely() encloses PageTransHuge() in the
original add_to_swap(), so I just follow the original style.  But I
don't think they make much sense too.  Will remove them in the next
version.

> Also please mention changes like these in the changelog next time.

Sorry and will do that in the future.

Best Regards,
Huang, Ying

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -mm -v9 0/3] THP swap: Delay splitting THP during swapping out "Huang, Ying" <ying.huang@intel.com> - 2017-04-19 09:10 +0200
  [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out "Huang, Ying" <ying.huang@intel.com> - 2017-04-19 09:10 +0200
    Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during  swap out Johannes Weiner <hannes@cmpxchg.org> - 2017-04-19 18:00 +0200
      Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out "Huang\, Ying" <ying.huang@intel.com> - 2017-04-20 02:50 +0200
    Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during  swap out Johannes Weiner <hannes@cmpxchg.org> - 2017-04-21 16:10 +0200
      Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out "Huang\, Ying" <ying.huang@intel.com> - 2017-04-22 02:10 +0200

csiph-web