Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2861290pxv; Mon, 12 Jul 2021 03:50:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi8fuGfe3GNZ4tmX+4W5UI8xPF7o3D6KGVC8RgEDS6/dI+Rls0glcPPs1iRh5Rtp0i0crH X-Received: by 2002:a6b:b883:: with SMTP id i125mr2713814iof.104.1626087010676; Mon, 12 Jul 2021 03:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626087010; cv=none; d=google.com; s=arc-20160816; b=KJnU3h/DLtvdIqjuh3g1/KQSWxRDF8fi6E0/Xp2p4mKyo6RUCRSxmn5sbDe/78YpQM MjTRLdiTXymN99IEDUs4i1ztVsyN0GVoVPCZIrMeLZNKEMvrUj6jXe/P7ud4TL8Vai1d PjavqgG9h/8bBAeoHV4rEd9MjDfJvcBsICb0gTWn8T8St034UbVPcdEy+EDFPe7OlCEG u4GV6kRPYOUZo40CcsBlsTeczVidkx95qAfcNnTuONEPre/pVBGVloXZWmNRFnWctdRP 2nGpZ7LhOkdbDxD7ZgTx2xbBEgN+uvlX2fu6Tam+vim3LAc2OE5lMml1rANAb/QvoTP0 ykdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w4cJtWfgNdB9jw5QmRRtovfgurQUBwI+1Wvxg2KUymQ=; b=GFwdVoMGhECMDsvZgDbYh1/YcB3u32Ubp0JgE0B2SkvW+OR5Toow789XN14sgugQuZ A6Hj8qM+Uo2eXcPz6t56TK8tZtiyNf8Xdxu6NClLAL9QRbB2GQdsdpsjyyA+KPUu/gtB 2XRJ07E0fIMQ6eyLPoUeWBffoBeZIA4NvxmHGEKABz+CWVyRXNHVXPSlWNOS+JqntWfj bBJBAFPKbBAH7KHAnQrt3IFk/PuTwhQ68cWMISWjkp8nFJWsT2Gr+ofeFyCbKWBIBNVO UowszW3S5r7GA4GRs7C7uaULyAuwhpLyGVdjUUDy0TXo/jAV6bE9IBOIS3nytTtSdD4P Nl4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YU+opw+W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si17822353ilm.144.2021.07.12.03.49.59; Mon, 12 Jul 2021 03:50:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YU+opw+W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346423AbhGLII2 (ORCPT + 99 others); Mon, 12 Jul 2021 04:08:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:43378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344401AbhGLH3b (ORCPT ); Mon, 12 Jul 2021 03:29:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4107061453; Mon, 12 Jul 2021 07:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074698; bh=sotzp4vjjswgvpon5TPoI2fGgunuSzPX7j+uzbSC46g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YU+opw+WvwbxqZj3J2hAL/w+JX5yRmkzMDTevZc1A5fsLfKKmz2bWqslK/VU4IKZf y2YzzhQrR9KgJ0aWHqoylqx39xCcENHOgiug+2QuDsgrqN5uHE4TJDpq7sChRp7C0H GSiApkk6TVoU63rfWXFavmJX4Ec9Uc2xLZYnYyOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Yang Shi , Anshuman Khandual , David Hildenbrand , Zi Yan , William Kucharski , Matthew Wilcox , "Aneesh Kumar K . V" , Ralph Campbell , Song Liu , "Kirill A. Shutemov" , Rik van Riel , Johannes Weiner , Minchan Kim , Hugh Dickins , Alexey Dobriyan , Mike Kravetz , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.12 665/700] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK Date: Mon, 12 Jul 2021 08:12:28 +0200 Message-Id: <20210712061046.648021828@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaohe Lin [ Upstream commit b2bd53f18bb7f7cfc91b3bb527d7809376700a8e ] Patch series "Cleanup and fixup for huge_memory:, v3. This series contains cleanups to remove dedicated macro and remove unnecessary tlb_remove_page_size() for huge zero pmd. Also this adds missing read-only THP checking for transparent_hugepage_enabled() and avoids discarding hugepage if other processes are mapping it. More details can be found in the respective changelogs. Thi patch (of 5): Rewrite the pgoff checking logic to remove macro HPAGE_CACHE_INDEX_MASK which is only used here to simplify the code. Link: https://lkml.kernel.org/r/20210511134857.1581273-1-linmiaohe@huawei.com Link: https://lkml.kernel.org/r/20210511134857.1581273-2-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: Yang Shi Reviewed-by: Anshuman Khandual Reviewed-by: David Hildenbrand Cc: Zi Yan Cc: William Kucharski Cc: Matthew Wilcox Cc: "Aneesh Kumar K . V" Cc: Ralph Campbell Cc: Song Liu Cc: Kirill A. Shutemov Cc: Rik van Riel Cc: Johannes Weiner Cc: Minchan Kim Cc: Hugh Dickins Cc: Alexey Dobriyan Cc: Mike Kravetz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- include/linux/huge_mm.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 6686a0baa91d..2a7c58ea5ca9 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -155,15 +155,13 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) bool transparent_hugepage_enabled(struct vm_area_struct *vma); -#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1) - static inline bool transhuge_vma_suitable(struct vm_area_struct *vma, unsigned long haddr) { /* Don't have to check pgoff for anonymous vma */ if (!vma_is_anonymous(vma)) { - if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) != - (vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK)) + if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff, + HPAGE_PMD_NR)) return false; } -- 2.30.2