Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp482950pxf; Thu, 18 Mar 2021 05:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpEoOqZ00k/iIKOJ9aIcqdJAiG9kLY9IdImHqa/3jCoI8yD6PCZz99tkn3+OYKG5vb8fln X-Received: by 2002:a17:906:1e4f:: with SMTP id i15mr39976571ejj.349.1616070592203; Thu, 18 Mar 2021 05:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616070592; cv=none; d=google.com; s=arc-20160816; b=qGN4oagitRW2iEh7dO2BQLEMyfoyUTwq7iyxrmYWgBldHOo4NhV/NnKmHYzVuIIzxc p2lPGhHWgt28Og1T4F8LamFihB7mhEh6JqztZ19SODW8Lz4iC2RYXqp/j2wanfig84dL kvbY6MMqAUgycxqhfLFr5Tdy/UIzzLmVjc2Ly4Ii+BBwDpOVByuADBBOB22yfjW48Uum QCzl29kRuy7BmT/vNjipsV1aAiHCE4LMLUkt+CjAoi7xzROEQhRGRVfBW3O/8AtPmiN8 NDjH7+hcS3fjS3yRCvnwtG6lhUM5+6RJxIljqXISAVk7ILQm5MPU3kFLjGlLb1XCVITD Ub1A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PgEla0HzyF4F4UUZb4ETo1enrqFu2RRilgQorEo6FCk=; b=xf0jYBWPHL+fcRQNcx6iS958ZwDfFGgr/Tsiz5jIL5sF9FFz4iU+t11XjREQjsQs7m P/7dOrghgVjQydxqmkzNMC8XG1S2LksoDailbmPtekJpmRE6gi7YEYBJYVPLvjxOM3IM a2ZLTDbw3N4evu2v4mmNBY/xtEA0TveG2YcQ8+tG/ApCdi9Vr9QOZck+kVllHrVDZFgx kkQaBTsz9L1XTDg8BetA9wIUqsdGe8+evUOUks10fRPeZtJw+Dwe9WlDj2Q8L4DkULKB ov+lhEQq4B08EVrYGPD0IFL4CqDUDm1AbKObbGWRzZjlSjXi+Lle/t57yaMRg74yEUcv Gsdw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si1407867ejr.549.2021.03.18.05.29.29; Thu, 18 Mar 2021 05:29:52 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231224AbhCRM2f (ORCPT + 99 others); Thu, 18 Mar 2021 08:28:35 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13984 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbhCRM2L (ORCPT ); Thu, 18 Mar 2021 08:28:11 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F1R8M4zTQzrYRw; Thu, 18 Mar 2021 20:26:11 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Thu, 18 Mar 2021 20:27:57 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , , , , Subject: [PATCH v3 3/6] mm/huge_memory.c: rework the function do_huge_pmd_numa_page() slightly Date: Thu, 18 Mar 2021 08:27:19 -0400 Message-ID: <20210318122722.13135-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20210318122722.13135-1-linmiaohe@huawei.com> References: <20210318122722.13135-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code that checks if migrating misplaced transhuge page is needed is pretty hard to follow. Rework it and add a comment to make its logic more clear and improve readability. Signed-off-by: Miaohe Lin --- mm/huge_memory.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 01b96c638e73..23964adf5db2 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1462,12 +1462,6 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) */ page_locked = trylock_page(page); target_nid = mpol_misplaced(page, vma, haddr); - if (target_nid == NUMA_NO_NODE) { - /* If the page was locked, there are no parallel migrations */ - if (page_locked) - goto clear_pmdnuma; - } - /* Migration could have started since the pmd_trans_migrating check */ if (!page_locked) { page_nid = NUMA_NO_NODE; @@ -1476,6 +1470,11 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) spin_unlock(vmf->ptl); put_and_wait_on_page_locked(page, TASK_UNINTERRUPTIBLE); goto out; + } else if (target_nid == NUMA_NO_NODE) { + /* There are no parallel migrations and page is in the right + * node. Clear the numa hinting info in this pmd. + */ + goto clear_pmdnuma; } /* -- 2.19.1