From patchwork Mon Jul 19 01:08:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Min X-Patchwork-Id: 12384567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 736C6C636C8 for ; Mon, 19 Jul 2021 01:38:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B5D9F6113D for ; Mon, 19 Jul 2021 01:38:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5D9F6113D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lge.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D4ABB8D00FD; Sun, 18 Jul 2021 21:38:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD3C98D00FA; Sun, 18 Jul 2021 21:38:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B74738D00FD; Sun, 18 Jul 2021 21:38:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 8EFB18D00FA for ; Sun, 18 Jul 2021 21:38:56 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 261C31D595 for ; Mon, 19 Jul 2021 01:38:55 +0000 (UTC) X-FDA: 78377628630.34.6D8FA16 Received: from lgeamrelo11.lge.com (lgeamrelo12.lge.com [156.147.23.52]) by imf08.hostedemail.com (Postfix) with ESMTP id C107930000AE for ; Mon, 19 Jul 2021 01:38:52 +0000 (UTC) Received: from unknown (HELO lgeamrelo02.lge.com) (156.147.1.126) by 156.147.23.52 with ESMTP; 19 Jul 2021 10:08:50 +0900 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: chanho.min@lge.com Received: from unknown (HELO localhost.localdomain) (10.178.31.96) by 156.147.1.126 with ESMTP; 19 Jul 2021 10:08:50 +0900 X-Original-SENDERIP: 10.178.31.96 X-Original-MAILFROM: chanho.min@lge.com From: Chanho Min To: Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, "Kirill A . Shutemov" , Gunho Lee , Juneho Choi , Inkyu Hwang , Chanho Min Subject: [PATCH] mm: make falutaround selectable Date: Mon, 19 Jul 2021 10:08:45 +0900 Message-Id: <20210719010845.31898-1-chanho.min@lge.com> X-Mailer: git-send-email 2.17.1 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C107930000AE X-Stat-Signature: nfgxze61bjoezgmuhf6jtbqenusb9q3i Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of chanho.min@lge.com designates 156.147.23.52 as permitted sender) smtp.mailfrom=chanho.min@lge.com X-HE-Tag: 1626658732-207415 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: While faultaround can have performance gains, on certain platform it increases pss and causes swap to occur more frequently. This patch allows to unselect faultaround on platforms that do not want this behavior. Signed-off-by: Chanho Min --- mm/Kconfig | 6 ++++++ mm/memory.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 39a6a977537d..8f834386e7f3 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -750,4 +750,10 @@ config ARCH_HAS_PTE_SPECIAL config ARCH_HAS_HUGEPD bool +config FAULT_AROUND + bool "Enable fault around" + default y + help + This option enables fault around. If say N, fault_around_bytes set to PAGE_SIZE + and disables fault around. endmenu diff --git a/mm/memory.c b/mm/memory.c index 10d2e4734e82..0bb037265dda 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3500,7 +3500,11 @@ vm_fault_t finish_fault(struct vm_fault *vmf) } static unsigned long fault_around_bytes __read_mostly = +#ifdef CONFIG_FAULT_AROUND rounddown_pow_of_two(65536); +#else + PAGE_SIZE; +#endif #ifdef CONFIG_DEBUG_FS static int fault_around_bytes_get(void *data, u64 *val)