Received: by 10.223.176.5 with SMTP id f5csp1780051wra; Thu, 8 Feb 2018 03:24:01 -0800 (PST) X-Google-Smtp-Source: AH8x225VD4zY0wSc4If7uKCoft4KUfliNXjTwi1Kp5BGcYieO58+ITt1ZaF+qt4Qyag5ReejfgmY X-Received: by 10.99.109.77 with SMTP id i74mr277118pgc.380.1518089041001; Thu, 08 Feb 2018 03:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518089040; cv=none; d=google.com; s=arc-20160816; b=AlYFfrkemrqzXguFeMXTx5Rq0BDh+T4v5C3YQbCsoq6KvTqXpgLYpczMyJfymUANzV y6DJ5xhQq0T4z+BrNxirkj5GvbCp/FEyHi4TQNMJorHKPk+N8gTfZdB8MhcZdtx88OKc QprqdbBwxpgz3OV+wJ8mPSMYEZOx5IpG9buT20ahqWv03s44qzlE017g48L0bOdXnzLs QGVO5rhOUfk1qeoMnCjYW1UHKuZP63fhBOSTG/IqH22bFJ6hLnAIeVuppSIILK9FDyJH ykRyrlMGg0tkdz+5dj1CE5n0J7Pxmbn17VvFcO/tGOmreEpvH5xlMhTwqyShof6q8DRl sUPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=NqZ1cEB31YPtMRhcUHEUfULSK9U2CLgvg2oNHnsG2yo=; b=u6QxMTlyEv0zbHs2Snvbbp3aVh2pN3SI8Bb6Jq5KRvn6NLV47+yBcuENiaX7NazzA+ L63Rka+Q6suns+norUFv8ziPYCyHIyD+x9q9vrbVPsL+WcHy/kgzxqpZF/lIEQOHtNj0 WcYwUI87anjZfrBJTjVlafd/4t9qNnTqq28yaCJhOjrcbgJcwFIHUH9Ghax/KH1jaoHV ynJLIa7fHX/V/rCXNvUmE94Yy0vcjwm6KqVCI0TZZ16rhFd/Un+jgfRpME2dUkFz2E77 J47JY4065oM68Zy8Q+8UXqCKsfBRIkj0joShYbGnLhuukXLli0TMgr8ZbjyQIpydRzdU t2iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bZa2tiEw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si1372610plp.140.2018.02.08.03.23.47; Thu, 08 Feb 2018 03:24:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bZa2tiEw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752028AbeBHLW6 (ORCPT + 99 others); Thu, 8 Feb 2018 06:22:58 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:37904 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbeBHLW4 (ORCPT ); Thu, 8 Feb 2018 06:22:56 -0500 Received: by mail-pf0-f196.google.com with SMTP id q79so1625172pfl.5; Thu, 08 Feb 2018 03:22:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NqZ1cEB31YPtMRhcUHEUfULSK9U2CLgvg2oNHnsG2yo=; b=bZa2tiEwvkoazCX90SyTynXlY79qT6CMIRiOIhzzaz1gWEX278U/PFeqsSZ0ls/Mid wpNF9YBQ8T8DBEPZOg61zOnTK1nXiLfF3zue1Ocr/zEkH8E1pcvQCD1SntFHsmzV+VFx h37cU1gl5kNsJw92q627QrnUBUYoY6d8ZXwUeqZaQn1C0z/42Wm8fThmq47oQgRHEgDQ jMtteXQ+dUq9u5NycFm+VRu4lWvuHmskIiD14HL4sKbtOge9+nIUiJMScWb+m/23Ne+A 9iJR3+EGliKYFa9CUxrxmzo19GPd0zlx37fdMq0hpW8esVUoBqrGEZfMWyzWCNBdEa2C K1hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NqZ1cEB31YPtMRhcUHEUfULSK9U2CLgvg2oNHnsG2yo=; b=SPWWtG4ZXSJh2aoB2TnThbuu9PVdqOmWXrxGV4gCQD8LuhcD687S9h86HdFQT0hDrm KnuP+OBw1WYXcxpVjliKNyRI9Wlrt8CmgcIhwnAv+oSER822ABKWWjdyM0AQwWYCWG/f 6EX2/HUjRAHIJhT+jGFnWr0WZtkOLsinG8Md9I9xToKv3XYZf+rUlKoBUzdIl1q/YpI2 m1lZfZdAApZMIB737SsbSB26dPHixn5Y3wM2VlPAPv3cBn00LnjpY8hfAflpSZ8UJ7mN h2RDT2wPGHv4XQ/xAj77FFzRugAe317Hr8E1KkBZaHr9mVMr/7QhbWCU9cfwnPqKV5Dr U6mw== X-Gm-Message-State: APf1xPCxr3s6ZUgcooYUwMe5WpozbzujBPnR1bljxgFgwJiTwwhYfMvF T+yv+IOdDqNKC7rzY+kkibo= X-Received: by 10.101.85.15 with SMTP id f15mr263582pgr.153.1518088976058; Thu, 08 Feb 2018 03:22:56 -0800 (PST) Received: from localhost ([110.70.54.190]) by smtp.gmail.com with ESMTPSA id x23sm2524182pgc.8.2018.02.08.03.22.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Feb 2018 03:22:54 -0800 (PST) Date: Thu, 8 Feb 2018 20:22:51 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Andrew Morton , "Huang, Ying" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Konrad Rzeszutek Wilk , Dan Streetman , Seth Jennings , Tetsuo Handa , Shaohua Li , Michal Hocko , Johannes Weiner , Mel Gorman , Shakeel Butt , stable@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH -mm -v2] mm, swap, frontswap: Fix THP swap if frontswap enabled Message-ID: <20180208112251.GA710@jagdpanzerIV> References: <20180207070035.30302-1-ying.huang@intel.com> <20180207130534.259cd71a595c6275b2da38d3@linux-foundation.org> <20180208013635.GA596@jagdpanzerIV> <20180208102521.GB74192@eng-minchan1.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180208102521.GB74192@eng-minchan1.roam.corp.google.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (02/08/18 02:25), Minchan Kim wrote: [..] > > > if (PageTransHuge(page)) { > > > - if (IS_ENABLED(CONFIG_THP_SWAP)) > > > - get_swap_pages(1, true, &entry); > > > + /* Frontswap doesn't support THP */ > > > + if (!frontswap_enabled()) { > > > + if (IS_ENABLED(CONFIG_THP_SWAP)) > > > + get_swap_pages(1, true, &entry); > > > + } > > > return entry; > > > } > > > > I have proposed exactly the same thing [1], Minchan commented that > > it would introduce frontswap dependency to swap_slots.c [2]. Which > > is true, but I'd still probably prefer to handle it all in > > get_swap_page. Minchan, any objections? > > I didn't want to spread out frontswap stuff unless it has good value > because most of frontswap functions are located in mm/swapfile.c > at this moment. Sure, your points are perfectly valid. At the same time it might be the case that we already kind of expose that THP dependency thing to vmscan. The whole if (!add_to_swap()) { if (!PageTransHuge(page)) goto activate_locked; split_huge_page_to_list(page); add_to_swap(page); } looks a bit suspicious - if add_to_swap() fails and the page is THP then split it and add_to_swap() again. -ss