Received: by 10.223.176.5 with SMTP id f5csp1335070wra; Wed, 7 Feb 2018 17:37:36 -0800 (PST) X-Google-Smtp-Source: AH8x2241jcB1aKwJblSzR5H/ShZCTQXg2+t3t2lgutlcZgivWMbRq40CECXt70xhzcr91yAtOBGL X-Received: by 2002:a17:902:bd01:: with SMTP id p1-v6mr8217206pls.172.1518053856301; Wed, 07 Feb 2018 17:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518053856; cv=none; d=google.com; s=arc-20160816; b=LjjOW8k6EgXsmB+O71E+reEV34H+CbItlonrspgIc3SV/EJsTaQANQqR5pERlOlV1b wniOy9YFSEbqCWEIODcWYHZkCx1T7ugvnB6tulh0OKUva6Vr/xDs0+0+iTJH5P/8CDqE c6AxZEgXx1jSuu8D+vQilgB3B5BpJ6kozFYSfZfK5IIyxTnqAcDd+dtOIAdWU20KlVPb nGNmmgHWoIrV/j1bnQNFHYV0huPAg1wLLOn2yL4XY8/xkLmUYTim8M/fHSaXPi0eA7n+ B2Gc6NaZ664RTDdXG1g6WfbX7WPkxwmR0qf14rvtg951hIWBYt1IrRvYDK+1OzYqQNlg X/YA== 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=ddJIqtBWrQF3BDfvwSSxQO3IMW1ukNALsQQWXP/uLjU=; b=YuSdzHasIZUaCiN554f7NXD/iFeJTwL1axGbQbuljZS9RbLslSDbb5FS6NZ0d33Y+c 6IEP/ZcJwaYKlBgM/jETA1PG3XU9K/VDBBIM4h7lOgRJ2f8OiT+MqYje0bpK0T5nJGEm AwHLIUviNja4/9nzHlFd7iEL/0AsMvpztM4vcQ2e3k3fvG6z2eho3OQQcQQZw6aJAskV pZ1u0FVYu6/J9NFEY+lNpKTWZJ88ri4qhTm6MCHw7AdBtjcOuguxtQyoVMhAKVFJV7Kc /d6vjsyLOMyNvlX2DGtQxHbCkw7opZRA5XR7p/eeQcmv+tjhpDFpMcBu6c+SXG5+oCNQ jFUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GmS385En; 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 j23si124787pga.474.2018.02.07.17.37.22; Wed, 07 Feb 2018 17:37:36 -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=GmS385En; 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 S1751562AbeBHBgm (ORCPT + 99 others); Wed, 7 Feb 2018 20:36:42 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:42695 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750767AbeBHBgk (ORCPT ); Wed, 7 Feb 2018 20:36:40 -0500 Received: by mail-pg0-f48.google.com with SMTP id m28so1048970pgc.9; Wed, 07 Feb 2018 17:36:40 -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=ddJIqtBWrQF3BDfvwSSxQO3IMW1ukNALsQQWXP/uLjU=; b=GmS385EnR7RI2JfSaZhZF0hSANOyjwa6i5pWgD3Jex46U82XYYmBKNszPfN/DJMKYe iwp8kEqGrh06gvzdOnS15yydNWXI6bP35bDWQDyi9X899QvvMEkmfatejpJpyL+J1oYN DXd7h5DD51VQYhMNm79UDmQGOEW/QhugTAZwNAq1BACFNqBuBlyFiB+O/QZ+0ilPiF0W L1aMENLIkmghXvZKW3Qml3pW5z3BzFIlJn30DSnHZRO7UEjCPN+fRbiH0C5HTuJB/Nyh eXyNwQLte1Ga8I1P3Ncf5bDdLKkzEmMbz+dvQ93deNDeQdnxoIOD9rFnMJPhhUw9ugEO abwg== 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=ddJIqtBWrQF3BDfvwSSxQO3IMW1ukNALsQQWXP/uLjU=; b=ZzwJ2P7UNDXwumBcAn10uWMAQQXwbF3mE9QRYVZJO71eK6SqxeZr4k+a2s486Krgd1 TVRMCBPIAOnnluj+GZ8UtRGAamWWQCmofRkibuQ6yOFAH7J+WY/c8GnWU04KB8/BmA0j TGsu2oMV2v2th9m8KJYc8D72CzRmcdhASOF4P8wLmIW4l9QDfzad4QZQ2fuoWDB50l7x dpd8ZUypUx8MMkdBVU+Mt02QgyPvBWk4ZTRING5KjxkVwSEs2M0w+lQoikT8d2xeaEC6 K9l18Kfh/a1bJtr0Fjs1xC31NcAiO+bzsDVD+8b8ymuFZ510Db4OOYff5oY+WAyBeozW pPzA== X-Gm-Message-State: APf1xPC7ImQF+35WlwZgOTix9GOZGaGznKsvNDy+Qeevp7s4OoVehSUb m7AhBST3RR3zkeUvDI87LKE= X-Received: by 10.99.165.28 with SMTP id n28mr6612083pgf.103.1518053799726; Wed, 07 Feb 2018 17:36:39 -0800 (PST) Received: from localhost ([110.70.54.190]) by smtp.gmail.com with ESMTPSA id o63sm7618950pfa.101.2018.02.07.17.36.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Feb 2018 17:36:38 -0800 (PST) Date: Thu, 8 Feb 2018 10:36:35 +0900 From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: "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: <20180208013635.GA596@jagdpanzerIV> References: <20180207070035.30302-1-ying.huang@intel.com> <20180207130534.259cd71a595c6275b2da38d3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180207130534.259cd71a595c6275b2da38d3@linux-foundation.org> 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/07/18 13:05), Andrew Morton wrote: [..] > hm. This is assuming that "cluster==true" means "this is thp swap". > That's presently true, but is it appropriate that get_swap_pages() is > peeking at "cluster" to work out why it is being called? > > Or would it be cleaner to do this in get_swap_page()? Something like > > --- a/mm/swap_slots.c~a > +++ a/mm/swap_slots.c > @@ -317,8 +317,11 @@ swp_entry_t get_swap_page(struct page *p > entry.val = 0; > > 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? [1] https://marc.info/?l=linux-mm&m=151791052007719&w=2 [2] https://marc.info/?l=linux-mm&m=151792646812617&w=2 -ss