From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linuxppc-dev@lists.ozlabs.org, James Dykman <jdykman@us.ibm.com>
Subject: Re: [PATCH 1/1] powerpc/mm: Add memory barrier in __hugepte_alloc()
Date: Wed, 06 Apr 2016 15:39:17 +0530 [thread overview]
Message-ID: <8737qzxd4i.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160406095623.GA24283@dhcp22.suse.cz>
Michal Hocko <mhocko@kernel.org> writes:
> [ text/plain ]
> On Tue 05-04-16 12:05:47, Sukadev Bhattiprolu wrote:
> [...]
>> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
>> index d991b9e..081f679 100644
>> --- a/arch/powerpc/mm/hugetlbpage.c
>> +++ b/arch/powerpc/mm/hugetlbpage.c
>> @@ -81,6 +81,13 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
>> if (! new)
>> return -ENOMEM;
>>
>> + /*
>> + * Make sure other cpus find the hugepd set only after a
>> + * properly initialized page table is visible to them.
>> + * For more details look for comment in __pte_alloc().
>> + */
>> + smp_wmb();
>> +
>
> what is the pairing memory barrier?
>
>> spin_lock(&mm->page_table_lock);
>> #ifdef CONFIG_PPC_FSL_BOOK3E
>> /*
This is documented in __pte_alloc(). I didn't want to repeat the same
here.
/*
* Ensure all pte setup (eg. pte page lock and page clearing) are
* visible before the pte is made visible to other CPUs by being
* put into page tables.
*
* The other side of the story is the pointer chasing in the page
* table walking code (when walking the page table without locking;
* ie. most of the time). Fortunately, these data accesses consist
* of a chain of data-dependent loads, meaning most CPUs (alpha
* being the notable exception) will already guarantee loads are
* seen in-order. See the alpha page table accessors for the
* smp_read_barrier_depends() barriers in page table walking code.
*/
smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */
-aneesh
WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linuxppc-dev@lists.ozlabs.org, James Dykman <jdykman@us.ibm.com>
Subject: Re: [PATCH 1/1] powerpc/mm: Add memory barrier in __hugepte_alloc()
Date: Wed, 06 Apr 2016 15:39:17 +0530 [thread overview]
Message-ID: <8737qzxd4i.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160406095623.GA24283@dhcp22.suse.cz>
Michal Hocko <mhocko@kernel.org> writes:
> [ text/plain ]
> On Tue 05-04-16 12:05:47, Sukadev Bhattiprolu wrote:
> [...]
>> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
>> index d991b9e..081f679 100644
>> --- a/arch/powerpc/mm/hugetlbpage.c
>> +++ b/arch/powerpc/mm/hugetlbpage.c
>> @@ -81,6 +81,13 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
>> if (! new)
>> return -ENOMEM;
>>
>> + /*
>> + * Make sure other cpus find the hugepd set only after a
>> + * properly initialized page table is visible to them.
>> + * For more details look for comment in __pte_alloc().
>> + */
>> + smp_wmb();
>> +
>
> what is the pairing memory barrier?
>
>> spin_lock(&mm->page_table_lock);
>> #ifdef CONFIG_PPC_FSL_BOOK3E
>> /*
This is documented in __pte_alloc(). I didn't want to repeat the same
here.
/*
* Ensure all pte setup (eg. pte page lock and page clearing) are
* visible before the pte is made visible to other CPUs by being
* put into page tables.
*
* The other side of the story is the pointer chasing in the page
* table walking code (when walking the page table without locking;
* ie. most of the time). Fortunately, these data accesses consist
* of a chain of data-dependent loads, meaning most CPUs (alpha
* being the notable exception) will already guarantee loads are
* seen in-order. See the alpha page table accessors for the
* smp_read_barrier_depends() barriers in page table walking code.
*/
smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */
-aneesh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-04-06 10:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 19:05 [PATCH 1/1] powerpc/mm: Add memory barrier in __hugepte_alloc() Sukadev Bhattiprolu
2016-04-05 19:05 ` Sukadev Bhattiprolu
2016-04-06 9:56 ` Michal Hocko
2016-04-06 9:56 ` Michal Hocko
2016-04-06 10:09 ` Aneesh Kumar K.V [this message]
2016-04-06 10:09 ` Aneesh Kumar K.V
2016-04-06 11:27 ` Michal Hocko
2016-04-06 11:27 ` Michal Hocko
2016-07-22 5:50 ` [1/1] " Michael Ellerman
2016-07-22 5:50 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737qzxd4i.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=jdykman@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.