From patchwork Thu Mar 17 23:48:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12784677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B169C433F5 for ; Thu, 17 Mar 2022 23:48:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D44028D0007; Thu, 17 Mar 2022 19:48:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF5F38D0001; Thu, 17 Mar 2022 19:48:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A858E8D0007; Thu, 17 Mar 2022 19:48:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 90AA88D0001 for ; Thu, 17 Mar 2022 19:48:42 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 63668617C8 for ; Thu, 17 Mar 2022 23:48:42 +0000 (UTC) X-FDA: 79255520484.09.BFEC1BC Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf29.hostedemail.com (Postfix) with ESMTP id DA5E9120007 for ; Thu, 17 Mar 2022 23:48:41 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id o68-20020a17090a0a4a00b001c686a48263so1898913pjo.1 for ; Thu, 17 Mar 2022 16:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=30LWLJQV8dYXosutckVn4XhId3NQkyArrNjeupviuTU=; b=QAVrMWYYLggwaur7/Slf6NucuIwOCNCO6CoeQBthKAHyKZvkgx+a7sm2sHBPqQ0opF 4Ki5b6Z0eXLr3PGCm9qtgaAY/ODWDKMdlFmdYoeEq0N1GBRlIz2z2tIICaXP45MUsac/ f69JzjhxHzv8Bsf0K8UnOYG82Z8vsMetYba3YirBpAPXzyPHEbiwKSpahVFE7gDZoOY5 FvLg3msNOHnXsZsKaVFyPHJUUWR7ZAq2C7JZIPlQMklTIZjjvHOCDAnKEEpMlUeDhOW2 3TEalbREksSCv5UTseNYULzPHRoNQN60aTvVm/fgh8TzEUmBAhlMjIDjE5EqZkvYj82d J7uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=30LWLJQV8dYXosutckVn4XhId3NQkyArrNjeupviuTU=; b=LpKiSmVjjzbkwwW6p0RrhhYwnWuYI82XvRuvl8nUIB12FKPLr8B4bO3nQIyXqmOCXB OL7TFD6Pv7xid1zOYtKa5VrBb4nXZ6ZH5Cnk1zvJmfh3WibTSn+7pHErLREzgQslWFKo Rgt0Ip/vShKYwH2vOwQL13mfWcPGl0BJ0KzaU4p8YypQXU3wdZ3Q/QEP7s5/j4jjRWed kqIBUVWDm9xZkljnYc7QrBSRnTCsN0PBoeWN0TRGlWNcZf5udUTojTlMgIRkJifbRQ84 cOQygG6Y+BseaJn+0OipongIaexOa3g1Rc8wyrKbPe44QwWmQy2u+ZjKOtS2PFLiDAIp O3Og== X-Gm-Message-State: AOAM530z6EDBffjYyQ63jXDtK/7mFY0FDLEgI//d+8CUI4e8lzmyhfFj NW2SRFK8J7UdbetRSitavKQ= X-Google-Smtp-Source: ABdhPJyiE6aP96mN2Z6JWDNGGQUqnYvg1jk7rBq+HLDBH4ccEO+al+eqvAHhq16+7YAPwjWxn2X9Ng== X-Received: by 2002:a17:90a:ba07:b0:1bc:a0fd:faf with SMTP id s7-20020a17090aba0700b001bca0fd0fafmr8254608pjr.194.1647560921021; Thu, 17 Mar 2022 16:48:41 -0700 (PDT) Received: from localhost.localdomain (c-67-174-241-145.hsd1.ca.comcast.net. [67.174.241.145]) by smtp.gmail.com with ESMTPSA id o7-20020aa79787000000b004f8e44a02e2sm8581329pfp.45.2022.03.17.16.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 16:48:40 -0700 (PDT) From: Yang Shi To: vbabka@suse.cz, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, songliubraving@fb.com, riel@surriel.com, willy@infradead.org, ziy@nvidia.com, akpm@linux-foundation.org, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH 3/8] mm: khugepaged: skip DAX vma Date: Thu, 17 Mar 2022 16:48:22 -0700 Message-Id: <20220317234827.447799-4-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220317234827.447799-1-shy828301@gmail.com> References: <20220317234827.447799-1-shy828301@gmail.com> MIME-Version: 1.0 X-Stat-Signature: y7yn875dg8zqwoowb4zn7dsz6yw7p84y Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QAVrMWYY; spf=pass (imf29.hostedemail.com: domain of shy828301@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DA5E9120007 X-HE-Tag: 1647560921-55289 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: The DAX vma may be seen by khugepaged when the mm has other khugepaged suitable vmas. So khugepaged may try to collapse THP for DAX vma, but it will fail due to page sanity check, for example, page is not on LRU. So it is not harmful, but it is definitely pointless to run khugepaged against DAX vma, so skip it in early check. Reviewed-by: Miaohe Lin Signed-off-by: Yang Shi --- mm/khugepaged.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 82c71c6da9ce..a0e4fa33660e 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -448,6 +448,10 @@ static bool hugepage_vma_check(struct vm_area_struct *vma, if (vm_flags & VM_NO_KHUGEPAGED) return false; + /* Don't run khugepaged against DAX vma */ + if (vma_is_dax(vma)) + return false; + if (vma->vm_file && !IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff, HPAGE_PMD_NR)) return false;