Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp203949imm; Sun, 8 Jul 2018 23:35:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdJhOKUv1q3hss7QTxv4K/RK629iJSKLODcalFaMUozoQcXMngNpNXcsLTJIilLs4wQCqeZ X-Received: by 2002:a62:9992:: with SMTP id t18-v6mr20077159pfk.239.1531118132926; Sun, 08 Jul 2018 23:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531118132; cv=none; d=google.com; s=arc-20160816; b=Y3mrgyy9mLDYSO+pO0kjoLfoILWCI9bgkCUgod1hgaCruK0jRqKeg8ja0otVRSrx6C cmww+CvtXJkCEfcBIDZ1gTSlpQZrl/MeW2bPFEQ3dDy+Di2y8MFPHyMExpLxkrl7Y7wi i7q0xIT6EPSCuNnPt0YRKWLOUL9R3jZ8kWJgFh4Vq+bRkkSNqWFIzD7IBleVcN0gK6FR MFMq1EXzeX6em7Sm7vdtFvBSDdoucsY2n+mS07mozWLJx7BMvzooxGJp6B/TBp3tB49D zlQkeQ1yktlLuErqy4GXr57LlP1U5xrt+gZkWAcT7WV7RcKnWBI25lTNhMORxtF5yYuQ cRSA== 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=WUP7jDomuofLOBG6UeUn/rbDzMUbdgmMk05bxMbCsTo=; b=Gn0JwaUp0E1JlIG14Lo99ryqrvyW+2cQntUYt4fZbn/8blkqu6ypdqa8Asud7ePR+Y i8ydVVV3QJmM5Z0diZS7mCuZbHuSnRze+Wt9i5jE+v3RE/ld3HeIpIwYlkdDQil/C7dc VrbG6lZzB3VZLn4n4DhN17gRR6sfKlwEZTATtYQxf4SsYG4kv0xBK1SiYZ8lliDmxx36 yOtf81MCrrqZnprr38CjZimeMM2bZ3owEyy5RQnxlZqA27m1c5n03s6HwxHLZJPOu7Fh dvypcyXINnvKN6VTJVqe79SrzgWi+SbSnjt5635O+yDhy4WFj88GqMI3LP8ap8rKI4c0 sbEw== 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 r138-v6si15699543pfc.202.2018.07.08.23.35.18; Sun, 08 Jul 2018 23:35:32 -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 S1754578AbeGIGeH (ORCPT + 99 others); Mon, 9 Jul 2018 02:34:07 -0400 Received: from mga03.intel.com ([134.134.136.65]:43811 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbeGIGeG (ORCPT ); Mon, 9 Jul 2018 02:34:06 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jul 2018 23:34:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69722800" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.13.118]) by fmsmga004.fm.intel.com with ESMTP; 08 Jul 2018 23:34:03 -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 , Hugh Dickins , Minchan Kim , Rik van Riel , Dave Hansen , Naoya Horiguchi , , 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> <87muv1kluq.fsf@yhuang-dev.intel.com> Date: Mon, 09 Jul 2018 14:34:02 +0800 In-Reply-To: (Dan Williams's message of "Sun, 8 Jul 2018 23:08:24 -0700") Message-ID: <87bmbglxyd.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 Sun, Jul 8, 2018 at 10:40 PM, Huang, Ying wrote: >> Dan Williams writes: >>> 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. Take pagemap_pmd_range() in fs/proc/task_mmu.c as an example, to avoid #ifdef, we may wrap all code between #ifdef/#endif into a separate function, put the new function into another C file (which is compiled only if #ifdef is true), then change header files for that too. In this way, we avoid #ifdef/#endif, but the code is more complex and tightly related code may be put into different files. The readability may be hurt too. Maybe you have smarter way to change the code to avoid #ifdef and improve code readability? Best Regards, Huang, Ying