From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Toshi Kani <toshi.kani@hp.com>
Cc: akpm@linux-foundation.org, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, tangchen@cn.fujitsu.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
guz.fnst@cn.fujitsu.com, zhangyanfei@cn.fujitsu.com
Subject: Re: [PATCH 2/2] x86,mem-hotplug: modify PGD entry when removing memory
Date: Tue, 24 Jun 2014 09:31:50 +0900 [thread overview]
Message-ID: <53A8C6F6.2060906@jp.fujitsu.com> (raw)
In-Reply-To: <1403289003.25108.3.camel@misato.fc.hp.com>
(2014/06/21 3:30), Toshi Kani wrote:
> On Wed, 2014-06-18 at 15:38 +0900, Yasuaki Ishimatsu wrote:
> :
>> @@ -186,7 +186,12 @@ void sync_global_pgds(unsigned long start, unsigned long end)
>> const pgd_t *pgd_ref = pgd_offset_k(address);
>> struct page *page;
>>
>> - if (pgd_none(*pgd_ref))
>> + /*
>> + * When it is called after memory hot remove, pgd_none()
>> + * returns true. In this case (removed == 1), we must clear
>> + * the PGD entries in the local PGD level page.
>> + */
>> + if (pgd_none(*pgd_ref) && !removed)
>> continue;
>>
>> spin_lock(&pgd_lock);
>> @@ -199,12 +204,18 @@ void sync_global_pgds(unsigned long start, unsigned long end)
>> pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
>> spin_lock(pgt_lock);
>>
>> - if (pgd_none(*pgd))
>> - set_pgd(pgd, *pgd_ref);
>> - else
>> + if (!pgd_none(*pgd_ref) && !pgd_none(*pgd))
>> BUG_ON(pgd_page_vaddr(*pgd)
>> != pgd_page_vaddr(*pgd_ref));
>>
>> + if (removed) {
>
> Shouldn't this condition be "else if"?
The first if sentence checks whether PGDs hit to BUG_ON. And the second
if sentence checks whether the function was called after hot-removing memory.
I think that the first if sentence and the second if sentence check different
things. So I think the condition should be "if" sentence.
Thanks,
Yasuaki Ishimatsu
>
> Thanks,
> -Toshi
>
>> + if (pgd_none(*pgd_ref) && !pgd_none(*pgd))
>> + pgd_clear(pgd);
>> + } else {
>> + if (pgd_none(*pgd))
>> + set_pgd(pgd, *pgd_ref);
>> + }
>> +
>> spin_unlock(pgt_lock);
>> }
>
>
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Toshi Kani <toshi.kani@hp.com>
Cc: <akpm@linux-foundation.org>, <tglx@linutronix.de>,
<mingo@redhat.com>, <hpa@zytor.com>, <tangchen@cn.fujitsu.com>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<x86@kernel.org>, <guz.fnst@cn.fujitsu.com>,
<zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH 2/2] x86,mem-hotplug: modify PGD entry when removing memory
Date: Tue, 24 Jun 2014 09:31:50 +0900 [thread overview]
Message-ID: <53A8C6F6.2060906@jp.fujitsu.com> (raw)
In-Reply-To: <1403289003.25108.3.camel@misato.fc.hp.com>
(2014/06/21 3:30), Toshi Kani wrote:
> On Wed, 2014-06-18 at 15:38 +0900, Yasuaki Ishimatsu wrote:
> :
>> @@ -186,7 +186,12 @@ void sync_global_pgds(unsigned long start, unsigned long end)
>> const pgd_t *pgd_ref = pgd_offset_k(address);
>> struct page *page;
>>
>> - if (pgd_none(*pgd_ref))
>> + /*
>> + * When it is called after memory hot remove, pgd_none()
>> + * returns true. In this case (removed == 1), we must clear
>> + * the PGD entries in the local PGD level page.
>> + */
>> + if (pgd_none(*pgd_ref) && !removed)
>> continue;
>>
>> spin_lock(&pgd_lock);
>> @@ -199,12 +204,18 @@ void sync_global_pgds(unsigned long start, unsigned long end)
>> pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
>> spin_lock(pgt_lock);
>>
>> - if (pgd_none(*pgd))
>> - set_pgd(pgd, *pgd_ref);
>> - else
>> + if (!pgd_none(*pgd_ref) && !pgd_none(*pgd))
>> BUG_ON(pgd_page_vaddr(*pgd)
>> != pgd_page_vaddr(*pgd_ref));
>>
>> + if (removed) {
>
> Shouldn't this condition be "else if"?
The first if sentence checks whether PGDs hit to BUG_ON. And the second
if sentence checks whether the function was called after hot-removing memory.
I think that the first if sentence and the second if sentence check different
things. So I think the condition should be "if" sentence.
Thanks,
Yasuaki Ishimatsu
>
> Thanks,
> -Toshi
>
>> + if (pgd_none(*pgd_ref) && !pgd_none(*pgd))
>> + pgd_clear(pgd);
>> + } else {
>> + if (pgd_none(*pgd))
>> + set_pgd(pgd, *pgd_ref);
>> + }
>> +
>> spin_unlock(pgt_lock);
>> }
>
>
next prev parent reply other threads:[~2014-06-24 0:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 6:34 [PATCH 0/2] fix kernel panic on memory hotplug Yasuaki Ishimatsu
2014-06-18 6:34 ` Yasuaki Ishimatsu
2014-06-18 6:37 ` [PATCH 1/2] x86,mem-hotplug: pass sync_global_pgds() a correct argument in remove_pagetable() Yasuaki Ishimatsu
2014-06-18 6:37 ` Yasuaki Ishimatsu
2014-06-20 18:27 ` Toshi Kani
2014-06-20 18:27 ` Toshi Kani
2014-06-24 0:33 ` Yasuaki Ishimatsu
2014-06-24 0:33 ` Yasuaki Ishimatsu
2014-06-18 6:38 ` [PATCH 2/2] x86,mem-hotplug: modify PGD entry when removing memory Yasuaki Ishimatsu
2014-06-18 6:38 ` Yasuaki Ishimatsu
2014-06-20 18:30 ` Toshi Kani
2014-06-20 18:30 ` Toshi Kani
2014-06-24 0:31 ` Yasuaki Ishimatsu [this message]
2014-06-24 0:31 ` Yasuaki Ishimatsu
2014-06-24 15:12 ` Toshi Kani
2014-06-24 15:12 ` Toshi Kani
2014-06-24 23:29 ` Yasuaki Ishimatsu
2014-06-24 23:29 ` Yasuaki Ishimatsu
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=53A8C6F6.2060906@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=guz.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=tangchen@cn.fujitsu.com \
--cc=tglx@linutronix.de \
--cc=toshi.kani@hp.com \
--cc=x86@kernel.org \
--cc=zhangyanfei@cn.fujitsu.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.