Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp169456imm; Sun, 8 Jul 2018 22:42:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjWg1SA5k8OpQH8NlXZAP6PrWuFjQDv4I/tM73/tdBZUrjg7cwah1JtT/urY+KfTwLXdtn X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr19504924pls.335.1531114931802; Sun, 08 Jul 2018 22:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531114931; cv=none; d=google.com; s=arc-20160816; b=D6DUQcQJcrnYmQ8IRPMaVTA9avORaZFS/PjC7XV8KVqpGMTBOGVF6eQulZRRoV1KQA 8Y1kEvC85Plls5oJ8/AvbuY93rntPO3SJYy546lrEpWzajmZlOPsKOXFABfprjs9RcZN rWUIMCTSzUO84N3mth5540ZuHWAWBnDTDdMV07tgey82CU0lUYUavteXsxyoZNTIrmiQ saGJvF/GJC9Z9Z0jZqg+ddYKLwP7SIzqLFyat2FgX6kAxA2h/MIyswWsoaY783VjSU7I zlXQ4A29lqOech861EJmM97S3so1EeDkHOCDD1GP7zWtKY4xGzKaZmsbHlmWl7jzsr+P Uzng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=dnwA0gw6/8aShBbfAheoz5LqybQ8A1K8hd3/ma90hG4=; b=p0mj61Eikdj90ADvxrOvmxl5pDRTpXUPydf6RnetJjXTmXuoyoNfCJ0Rb3P47mGV/x OD8jlPWYQAR8iuvgygU4u58ssUkLujf7rNgMiqFWoUlieRNp9jzWrt1c4skXAk2xrfuq 0Avh43rJTyFn0XLAhJvHS5uszZAesYs6ZCD5D4qAzDVmchqeJQ4ZrRXjTRSW23VBea/m 0YnitKQhwldH+amvs1yalSKzNeF2BmJtDSVzIl45Vgduh+G48WlIYfxFo3Frrr8P93y9 gyTxXptKesDpdOc4RvsjMs2wMXbIeKC5FhnhlQLN6PCH4fNA6yIu4HAvgkAD+7K+tuZt FbQA== ARC-Authentication-Results: i=1; mx.google.com; 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 d30-v6si13461878pla.64.2018.07.08.22.41.57; Sun, 08 Jul 2018 22:42:11 -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; 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 S1754142AbeGIFku (ORCPT + 99 others); Mon, 9 Jul 2018 01:40:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:52396 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbeGIFkt (ORCPT ); Mon, 9 Jul 2018 01:40:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jul 2018 22:40:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="63225381" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.13.118]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jul 2018 22:40:46 -0700 From: "Huang\, Ying" To: Dan Williams Cc: Andrew Morton , linux-mm , Linux Kernel Mailing List , "Kirill A. Shutemov" , Andrea Arcangeli , Michal Hocko , Johannes Weiner , Shaohua Li , , Minchan Kim , Rik van Riel , Dave Hansen , , , Subject: Re: [PATCH -mm -v4 01/21] mm, THP, swap: Enable PMD swap operations for CONFIG_THP_SWAP References: <20180622035151.6676-1-ying.huang@intel.com> <20180622035151.6676-2-ying.huang@intel.com> Date: Mon, 09 Jul 2018 13:40:45 +0800 In-Reply-To: (Dan Williams's message of "Sat, 7 Jul 2018 14:11:18 -0700") Message-ID: <87muv1kluq.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best Regards, Huang, Ying