Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp187069imm; Sun, 8 Jul 2018 23:09:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfAmy/MC4JFaXH0Tnp5daNRVQZs9sK8AFff/9t6vHO09UG3FqhYA4zxyFV5d+oZtVKYeBvE X-Received: by 2002:a62:3a5b:: with SMTP id h88-v6mr19960100pfa.61.1531116570942; Sun, 08 Jul 2018 23:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531116570; cv=none; d=google.com; s=arc-20160816; b=qMn64dL1o/wFJ95yigguQP8Zg3oGmowgalvxpAQ/eQjMMFVci7o62w0ruIlVtw0a8c ZwI0A4btlPWgcZCpA5foQ6TcBaI+/y7k+fKhPObA28f+79wBHu7TVG9PKBb9E9mjkQmH R/R0qCH7NN6b1JNvtO509NWhJX9Skmh7gb5gOFdFSztFOm3T1hDXmJXWsUaGj+QKdZAF Wl7TDQp2r539Br0augmEqXKNQW6Js3CyyOqrrlTWcKZC87ET5ZRJ9CERC3h21BBtielK rTyv1ut4ksXG5JKK1/Fj3HnAYZv6mDoFVZtnAZmKI1MesbuSvuTKaQ7wirl5D2WQuSzt 3yiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=P4jcJAq3iIHqPi9ivj41bgsOIIsduwuwZRlpyX2lUS0=; b=u9OpCOkx2/cwJzle8Xq5dBEisLmsoJA3j6X/Szt9uSH9wEcO4T5Z4cwm54VMwsQ6ZQ /q56cq3j3RA00beIGIEg1lro642UrVaXqfVm8cXKU9d6JMtJI1CqkU3CpYPNcd5EfEWE G6GRoQKTpzvUf5cUqzG1zFh7fj3L5IKoaK6g8vAV61xeTT3zM15sEGacHZoQGBxMyvlz MBYeDOpEf83ziO4T4gIcb3iylSTi1FcE+gp36BeOI0cN6eyYXnpc5IaUXeDSgdd8X/aP rwA6+jPtGlyewGFj/11vBCTnybVVi/F+9H8l8toTqWD+SZSlEtDdaDduV430AxTqgd5F U+sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=1Sdvx9W2; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si11937484plb.27.2018.07.08.23.09.16; Sun, 08 Jul 2018 23:09:30 -0700 (PDT) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=1Sdvx9W2; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932459AbeGIGI1 (ORCPT + 99 others); Mon, 9 Jul 2018 02:08:27 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:37319 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754367AbeGIGIZ (ORCPT ); Mon, 9 Jul 2018 02:08:25 -0400 Received: by mail-oi0-f67.google.com with SMTP id k81-v6so33728697oib.4 for ; Sun, 08 Jul 2018 23:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=P4jcJAq3iIHqPi9ivj41bgsOIIsduwuwZRlpyX2lUS0=; b=1Sdvx9W2k/2aB/yzFxeNek6AVEz3Vi7ak8UDwjDkraqZsI8FEIkvIOda8MO8GzXubO h2LRlce/aj5AJ1VartheKTvMz/s+QjFgDWWwXP2rQeG9+Lg1viS1pznv3F082eppvZ+S ZrrjaW06UxlKPuTjwgbs/AHng0yhZxMJRGrSXjFaD4rRME4A7y6/CDs+XaKgAAUNcI71 w6et7euKePk5BWDjKjLNxhTbiQ6gOmj3/uJ3ipj5raj/rM5RmC2Y7YHQiVjyNNa9Q0X2 AGnIKIQp9w+DpFMdmG8LYGWmX5hIwvSvZHckJM2og0Uj0iImmuWyqVO3HQOFr7Y0Z/bW 2mhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=P4jcJAq3iIHqPi9ivj41bgsOIIsduwuwZRlpyX2lUS0=; b=g+7yXCAq9afAgbCIFY5kkAwsmt4mQsjJgdBjL4X9EAuzZpy4cQwRpBxAGXey6CH7nX bco8WlxIQ1kcGyOm6ximjSYqkN8ehCx6QRUTOA2WCUgkDVhd+DFssyWAa4IksOEDOiB0 QUbX2nxmOcsNQZGk2/Cst6kJMH21C/IOVB+JkEjqcnf1879TNvcWx424Kp2epxj9tvba SGNDL4MFoEEp/PVpLmvbLvQ/pGHy4IEm1Z5MTPKe3ZFCiT6Fzd1fOCx+uCw9RyfzJpBh BL1IwkCw5vEIze96itkef/vKybtCSC49kCF6oELV9lTS0RWo6iajM2nwUUk5V1U9SeoU EH+w== X-Gm-Message-State: APt69E2VZ/pv9OIjy4y9C+DRgoqUJ1QA0R2VoVFmwugJ11lOoa9F8JMz o4aSDhGeyZaVCe8sbmdMnB2PyvqPlsPVBlMyPp1roQ== X-Received: by 2002:aca:3954:: with SMTP id g81-v6mr23134154oia.215.1531116505005; Sun, 08 Jul 2018 23:08:25 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:3495:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 23:08:24 -0700 (PDT) In-Reply-To: <87muv1kluq.fsf@yhuang-dev.intel.com> References: <20180622035151.6676-1-ying.huang@intel.com> <20180622035151.6676-2-ying.huang@intel.com> <87muv1kluq.fsf@yhuang-dev.intel.com> From: Dan Williams Date: Sun, 8 Jul 2018 23:08:24 -0700 Message-ID: Subject: Re: [PATCH -mm -v4 01/21] mm, THP, swap: Enable PMD swap operations for CONFIG_THP_SWAP To: "Huang, Ying" Cc: Andrew Morton , linux-mm , Linux Kernel Mailing List , "Kirill A. Shutemov" , Andrea Arcangeli , Michal Hocko , Johannes Weiner , Shaohua Li , Hugh Dickins , Minchan Kim , Rik van Riel , Dave Hansen , Naoya Horiguchi , zi.yan@cs.rutgers.edu, daniel.m.jordan@oracle.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 8, 2018 at 10:40 PM, Huang, Ying wrote: > Dan Williams writes: > >> On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying wrote: >>> >>> From: Huang Ying >>> >>> Previously, the PMD swap operations are only enabled for >>> CONFIG_ARCH_ENABLE_THP_MIGRATION. Because they are only used by the >>> THP migration support. We will support PMD swap mapping to the huge >>> swap cluster and swapin the THP as a whole. That will be enabled via >>> CONFIG_THP_SWAP and needs these PMD swap operations. So enable the >>> PMD swap operations for CONFIG_THP_SWAP too. >>> >>> Signed-off-by: "Huang, Ying" >>> Cc: "Kirill A. Shutemov" >>> Cc: Andrea Arcangeli >>> Cc: Michal Hocko >>> Cc: Johannes Weiner >>> Cc: Shaohua Li >>> Cc: Hugh Dickins >>> Cc: Minchan Kim >>> Cc: Rik van Riel >>> Cc: Dave Hansen >>> Cc: Naoya Horiguchi >>> Cc: Zi Yan >>> Cc: Daniel Jordan >>> --- >>> arch/x86/include/asm/pgtable.h | 2 +- >>> include/asm-generic/pgtable.h | 2 +- >>> include/linux/swapops.h | 44 ++++++++++++++++++++++-------------------- >>> 3 files changed, 25 insertions(+), 23 deletions(-) >>> >>> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h >>> index 99ecde23c3ec..13bf58838daf 100644 >>> --- a/arch/x86/include/asm/pgtable.h >>> +++ b/arch/x86/include/asm/pgtable.h >>> @@ -1224,7 +1224,7 @@ static inline pte_t pte_swp_clear_soft_dirty(pte_t pte) >>> return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY); >>> } >>> >>> -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION >>> +#if defined(CONFIG_ARCH_ENABLE_THP_MIGRATION) || defined(CONFIG_THP_SWAP) >> >> How about introducing a new config symbol representing the common >> infrastructure between the two and have them select that symbol. > > The common infrastructure shared by two mechanisms is PMD swap entry. > But I didn't find there are many places where the common infrastructure > is used. So I think it may be over-engineering to introduce a new > config symbol but use it for so few times. > >> Would that also allow us to clean up the usage of >> CONFIG_ARCH_ENABLE_THP_MIGRATION in fs/proc/task_mmu.c? In other >> words, what's the point of having nice ifdef'd alternatives in header >> files when ifdefs are still showing up in C files, all of it should be >> optionally determined by header files. > > Unfortunately, I think it is not a easy task to wrap all C code via > #ifdef in header files. And it may be over-engineering to wrap them > all. I guess this is why there are still some #ifdef in C files. That's the entire point. Yes, over-engineer the header files so the actual C code is more readable.