xfs
[Top] [All Lists]

Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd

To: Mel Gorman <mgorman@xxxxxxx>
Subject: Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Mar 2015 12:13:27 -0800
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Aneesh Kumar <aneesh.kumar@xxxxxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Linux-MM <linux-mm@xxxxxxxxx>, xfs@xxxxxxxxxxx, ppc-dev <linuxppc-dev@xxxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=DTaY/RMit5XLV6ai0gp/bM81vB+jvSPLMg6cwVtiyLw=; b=hGGOCiKjJNvUTMubEq7dm4g/ICb8EM8HjaDLI/lP1xsynHzKScDRh2xRgdubyAOcCb OGIHTzWlG1cFi2bzLFXmTLSsHRDZa0DOLPrf/s4fOrM8TK0Xte4Kyq/3iccH0b+n/NUm FByAJGU9qba85sVSAuaM+/eG/qcZONe4Xo5w8YKihf1nUbaiINO/J5x0smxwXBub+oor IobWplN5gPbaX9dUKF+Xp8O7Kw0G/e1l0Id6ynf3Yqw+SjLi+xZYfWSva9d2+hA12b5S xZ/Einb8cxCCtN92kPhdFs7I2StuUxZMSX/UYrniRsEhe3w5aR+SbZHjfUGRgzKtYqF8 a9MA==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=DTaY/RMit5XLV6ai0gp/bM81vB+jvSPLMg6cwVtiyLw=; b=S08d3gzX7GgzZr6nlnNV4kO+f8fHboBPvd4X2vxENH/nGsSA7IKoITZ0kR5/kBUqM9 2QLlD14cCDXZIdLfqrOP+jcijX45MkUpHfmSUXCjH6nTF6pCiIzPmuBXR6fwokhjmKfK wZcNuM5TfxehFuhbKlov0zSaJlV3UhoNvF9xc=
In-reply-to: <1425741651-29152-2-git-send-email-mgorman@xxxxxxx>
References: <1425741651-29152-1-git-send-email-mgorman@xxxxxxx> <1425741651-29152-2-git-send-email-mgorman@xxxxxxx>
Sender: linus971@xxxxxxxxx
Looks obviously correct. The old code was just very wrong.

Acked-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

                     Linus


On Sat, Mar 7, 2015 at 7:20 AM, Mel Gorman <mgorman@xxxxxxx> wrote:
> The wrong value is being returned by change_huge_pmd since commit
> 10c1045f28e8 ("mm: numa: avoid unnecessary TLB flushes when setting
> NUMA hinting entries") which allows a fallthrough that tries to adjust
> non-existent PTEs. This patch corrects it.
>
> Signed-off-by: Mel Gorman <mgorman@xxxxxxx>
> ---
>  mm/huge_memory.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index fc00c8cb5a82..194c0f019774 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1482,6 +1482,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t 
> *pmd,
>
>         if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
>                 pmd_t entry;
> +               ret = 1;
>
>                 /*
>                  * Avoid trapping faults against the zero page. The read-only
> @@ -1490,11 +1491,10 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t 
> *pmd,
>                  */
>                 if (prot_numa && is_huge_zero_pmd(*pmd)) {
>                         spin_unlock(ptl);
> -                       return 0;
> +                       return ret;
>                 }
>
>                 if (!prot_numa || !pmd_protnone(*pmd)) {
> -                       ret = 1;
>                         entry = pmdp_get_and_clear_notify(mm, addr, pmd);
>                         entry = pmd_modify(entry, newprot);
>                         ret = HPAGE_PMD_NR;
> --
> 2.1.2
>

<Prev in Thread] Current Thread [Next in Thread>