From patchwork Sun Jan 31 00:11:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 12057449 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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 33D6AC433DB for ; Sun, 31 Jan 2021 00:16:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C8E5E64E17 for ; Sun, 31 Jan 2021 00:16:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8E5E64E17 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B5D5F6B0071; Sat, 30 Jan 2021 19:16:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ABB936B0072; Sat, 30 Jan 2021 19:16:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C2496B0073; Sat, 30 Jan 2021 19:16:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 7060D6B0071 for ; Sat, 30 Jan 2021 19:16:10 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 383E51EE6 for ; Sun, 31 Jan 2021 00:16:10 +0000 (UTC) X-FDA: 77764152900.18.rat72_48042d9275b5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 1BDDF100ED586 for ; Sun, 31 Jan 2021 00:16:10 +0000 (UTC) X-HE-Tag: rat72_48042d9275b5 X-Filterd-Recvd-Size: 6612 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sun, 31 Jan 2021 00:16:09 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id i63so9062986pfg.7 for ; Sat, 30 Jan 2021 16:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZzlVqewRXAg3OMvze9ev5t9d0DHfKiwF7Fd8unaArI0=; b=a/vzewfyyogHVl7oec30+NCJAuiKllkXhkf/E92lZlob0Juz6BSXZ4LybGQOgTD7Pb qjPdbwodVyGr1gRxpvoQourmMUu56/daQ1UKeXadpoz/CvQF+35+maIzvYKdg1KoioKy RXitPbiy/dwIzfqN1x9Hmvde8fUl1GSNtVNBpNSuHEYMZoRb1mSel32bn+kr9VkA0HgL nm/iPrmaqNVze6dgkSwUtdAQ44AmH7KMf2GtcLJBOEZfwKTrInGZv0jj5akCHUyRdiKE OJVWaziglwMV7bGvkUnuTE6n3KG+yR7DE+AB0ky8D4VB7VLvSbJZq+pKZ7HwauIlvYxR QYjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZzlVqewRXAg3OMvze9ev5t9d0DHfKiwF7Fd8unaArI0=; b=m0cwQ3tw64im6dHFYEthHWJDWl+P2+OFrHB0ZXsVrP4TBmYhZ6YNdGXpQaycRaAuoD HmQZNxN/9nSCFdNbLNTSHc4K0tG6zA0nPQ4vBVlXSh5vftlyPAymoEStg0MQB9f85/wd 4O2/VMRZeqUV49zIMv8L/FJABvA3mR0HBpd4IBO0fr04OjMZp5KbaDd2Ze/MXy90rKTP 4DRGaaqJnkXONq8ONT8K00IMgjDEkU07MfrgJtS7oTUdshl0JV4yBtawUoVSvf/4IkDT NenZeb2iVD2txCNiFMtHEF5mLoOdvukCA+iE3TLJQmEV5+cHzNQWnnKwjiaQA5o/Omx4 ZhSA== X-Gm-Message-State: AOAM530Y79F2IbjsJcaLTT7WLwChaT6lC0jepQJlZW/t7dxkQeBPN+s5 iKF2/xgnD6xzgGj8EH+E9NsUX//iU1I= X-Google-Smtp-Source: ABdhPJyhSETixc5AJsaHNKoGQJPd6srN/UgKTvNi1vnesRUTToIiDJ/7t8Kfp5f0pZIshkCllVGq+w== X-Received: by 2002:a63:f19:: with SMTP id e25mr10533814pgl.220.1612052168283; Sat, 30 Jan 2021 16:16:08 -0800 (PST) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id e12sm13127365pga.13.2021.01.30.16.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 16:16:07 -0800 (PST) From: Nadav Amit X-Google-Original-From: Nadav Amit To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Nadav Amit , Mel Gorman , Andrea Arcangeli , Andrew Morton , Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Gleixner , Will Deacon , Yu Zhao , x86@kernel.org Subject: [RFC 05/20] mm/tlb: move BATCHED_UNMAP_TLB_FLUSH to tlb.h Date: Sat, 30 Jan 2021 16:11:17 -0800 Message-Id: <20210131001132.3368247-6-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210131001132.3368247-1-namit@vmware.com> References: <20210131001132.3368247-1-namit@vmware.com> MIME-Version: 1.0 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: From: Nadav Amit Arguably, tlb.h is the natural place for TLB related code. In addition, task_mmu needs to be able to call to flush_tlb_batched_pending() and therefore cannot (or should not) use mm/internal.h. Move all the functions that are controlled by CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH to tlb.h. Signed-off-by: Nadav Amit Cc: Mel Gorman Cc: Andrea Arcangeli Cc: Andrew Morton Cc: Andy Lutomirski Cc: Dave Hansen Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Cc: Yu Zhao Cc: x86@kernel.org --- include/asm-generic/tlb.h | 17 +++++++++++++++++ mm/internal.h | 16 ---------------- mm/mremap.c | 2 +- mm/vmscan.c | 1 + 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index c2deec0b6919..517c89398c83 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -658,6 +658,23 @@ static inline void tlb_flush_p4d_range(struct mmu_gather *tlb, static inline bool pte_may_need_flush(pte_t oldpte, pte_t newpte) { return true; } #endif +#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH +void try_to_unmap_flush(void); +void try_to_unmap_flush_dirty(void); +void flush_tlb_batched_pending(struct mm_struct *mm); +#else +static inline void try_to_unmap_flush(void) +{ +} +static inline void try_to_unmap_flush_dirty(void) +{ +} +static inline void flush_tlb_batched_pending(struct mm_struct *mm) +{ +} +static inline void tlb_batch_init(void) { } +#endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */ + #endif /* CONFIG_MMU */ #endif /* _ASM_GENERIC__TLB_H */ diff --git a/mm/internal.h b/mm/internal.h index 25d2b2439f19..d3860f9fbb83 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -585,22 +585,6 @@ struct tlbflush_unmap_batch; */ extern struct workqueue_struct *mm_percpu_wq; -#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH -void try_to_unmap_flush(void); -void try_to_unmap_flush_dirty(void); -void flush_tlb_batched_pending(struct mm_struct *mm); -#else -static inline void try_to_unmap_flush(void) -{ -} -static inline void try_to_unmap_flush_dirty(void) -{ -} -static inline void flush_tlb_batched_pending(struct mm_struct *mm) -{ -} -#endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */ - extern const struct trace_print_flags pageflag_names[]; extern const struct trace_print_flags vmaflag_names[]; extern const struct trace_print_flags gfpflag_names[]; diff --git a/mm/mremap.c b/mm/mremap.c index f554320281cc..57655d1b1031 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "internal.h" diff --git a/mm/vmscan.c b/mm/vmscan.c index b1b574ad199d..ee144c359b41 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -52,6 +52,7 @@ #include #include +#include #include #include