Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1630157 > unrolled thread
| Started by | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| First post | 2017-04-25 05:00 +0200 |
| Last post | 2017-04-27 17:20 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: your mail Joonsoo Kim <js1304@gmail.com> - 2017-04-25 05:00 +0200
Re: your mail Michal Hocko <mhocko@kernel.org> - 2017-04-26 11:50 +0200
Re: your mail Joonsoo Kim <js1304@gmail.com> - 2017-04-27 04:10 +0200
Re: your mail Michal Hocko <mhocko@kernel.org> - 2017-04-27 17:20 +0200
| From | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| Date | 2017-04-25 05:00 +0200 |
| Subject | Re: your mail |
| Message-ID | <tzYRP-7bL-3@gated-at.bofh.it> |
On Mon, Apr 24, 2017 at 09:53:12AM +0200, Michal Hocko wrote: > On Mon 24-04-17 10:44:43, Joonsoo Kim wrote: > > On Fri, Apr 21, 2017 at 09:16:16AM +0200, Michal Hocko wrote: > > > On Fri 21-04-17 13:38:28, Joonsoo Kim wrote: > > > > On Thu, Apr 20, 2017 at 09:28:20AM +0200, Michal Hocko wrote: > > > > > On Thu 20-04-17 10:27:55, Joonsoo Kim wrote: > > > > > > On Mon, Apr 17, 2017 at 10:15:15AM +0200, Michal Hocko wrote: > > > > > [...] > > > > > > > Which pfn walkers you have in mind? > > > > > > > > > > > > For example, kpagecount_read() in fs/proc/page.c. I searched it by > > > > > > using pfn_valid(). > > > > > > > > > > Yeah, I've checked that one and in fact this is a good example of the > > > > > case where you do not really care about holes. It just checks the page > > > > > count which is a valid information under any circumstances. > > > > > > > > I don't think so. First, it checks the page *map* count. Is it still valid > > > > even if PageReserved() is set? > > > > > > I do not know about any user which would manipulate page map count for > > > referenced pages. The core MM code doesn't. > > > > That's weird that we can get *map* count without PageReserved() check, > > but we cannot get zone information. > > Zone information is more static information than map count. > > As I've already pointed out the rework of the hotplug code is mainly > about postponing the zone initialization from the physical hot add to > the logical onlining. The zone is really not clear until that moment. > > > It should be defined/documented in this time that what information in > > the struct page is valid even if PageReserved() is set. And then, we > > need to fix all the things based on this design decision. > > Where would you suggest documenting this? We do have > Documentation/memory-hotplug.txt but it is not really specific about > struct page. pfn_valid() in include/linux/mmzone.h looks proper place. > > [...] > > > > You are trying to change a semantic of something that has a well defined > > > meaning. I disagree that we should change it. It might sound like a > > > simpler thing to do because pfn walkers will have to be checked but what > > > you are proposing is conflating two different things together. > > > > I don't think that *I* try to change the semantic of pfn_valid(). > > It would be original semantic of pfn_valid(). > > > > "If pfn_valid() returns true, we can get proper struct page and the > > zone information," > > I do not see any guarantee about the zone information anywhere. In fact > this is not true with the original implementation as I've tried to > explain already. We do have new pages associated with a zone but that > association might change during the online phase. So you cannot really > rely on that information until the page is online. There is no real > change in that regards after my rework. I know that what you did doesn't change thing much. What I try to say is that previous implementation related to pfn_valid() in hotplug is wrong. Please do not assume that hotplug implementation is correct and other pfn_valid() users are incorrect. There is no design document so I'm not sure which one is correct but assumption that pfn_valid() user can access whole the struct page information makes much sense to me. So, I hope that please fix hotplug implementation rather than modifying each pfn_valid() users. > > [...] > > > So please do not conflate those two different concepts together. I > > > believe that the most prominent pfn walkers should be covered now and > > > others can be evaluated later. > > > > Even if original pfn_valid()'s semantic is not the one that I mentioned, > > I think that suggested semantic from me is better. > > Only hotplug code need to be changed and others doesn't need to be changed. > > There is no overhead for others. What's the problem about this approach? > > That this would require to check _every_ single pfn_valid user in the > kernel. That is beyond my time capacity and not really necessary because > the current code already suffers from the same/similar class of > problems. I think that all the pfn_valid() user doesn't consider hole case. Unlike your expectation, if your way is taken, it requires to check _every_ pfn_valid() users. Thanks.
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-04-26 11:50 +0200 |
| Message-ID | <tArKb-tv-61@gated-at.bofh.it> |
| In reply to | #1630157 |
On Tue 25-04-17 11:50:45, Joonsoo Kim wrote: > On Mon, Apr 24, 2017 at 09:53:12AM +0200, Michal Hocko wrote: > > On Mon 24-04-17 10:44:43, Joonsoo Kim wrote: > > > On Fri, Apr 21, 2017 at 09:16:16AM +0200, Michal Hocko wrote: > > > > On Fri 21-04-17 13:38:28, Joonsoo Kim wrote: > > > > > On Thu, Apr 20, 2017 at 09:28:20AM +0200, Michal Hocko wrote: > > > > > > On Thu 20-04-17 10:27:55, Joonsoo Kim wrote: > > > > > > > On Mon, Apr 17, 2017 at 10:15:15AM +0200, Michal Hocko wrote: > > > > > > [...] > > > > > > > > Which pfn walkers you have in mind? > > > > > > > > > > > > > > For example, kpagecount_read() in fs/proc/page.c. I searched it by > > > > > > > using pfn_valid(). > > > > > > > > > > > > Yeah, I've checked that one and in fact this is a good example of the > > > > > > case where you do not really care about holes. It just checks the page > > > > > > count which is a valid information under any circumstances. > > > > > > > > > > I don't think so. First, it checks the page *map* count. Is it still valid > > > > > even if PageReserved() is set? > > > > > > > > I do not know about any user which would manipulate page map count for > > > > referenced pages. The core MM code doesn't. > > > > > > That's weird that we can get *map* count without PageReserved() check, > > > but we cannot get zone information. > > > Zone information is more static information than map count. > > > > As I've already pointed out the rework of the hotplug code is mainly > > about postponing the zone initialization from the physical hot add to > > the logical onlining. The zone is really not clear until that moment. > > > > > It should be defined/documented in this time that what information in > > > the struct page is valid even if PageReserved() is set. And then, we > > > need to fix all the things based on this design decision. > > > > Where would you suggest documenting this? We do have > > Documentation/memory-hotplug.txt but it is not really specific about > > struct page. > > pfn_valid() in include/linux/mmzone.h looks proper place. diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c412e6a3a1e9..443258fcac93 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1288,10 +1288,14 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); #ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL /* * pfn_valid() is meant to be able to tell if a given PFN has valid memmap - * associated with it or not. In FLATMEM, it is expected that holes always - * have valid memmap as long as there is valid PFNs either side of the hole. - * In SPARSEMEM, it is assumed that a valid section has a memmap for the - * entire section. + * associated with it or not. This means that a struct page exists for this + * pfn. The caller cannot assume the page is fully initialized though. + * pfn_to_online_page() should be used to make sure the struct page is fully + * initialized. + * + * In FLATMEM, it is expected that holes always have valid memmap as long as + * there is valid PFNs either side of the hole. In SPARSEMEM, it is assumed + * that a valid section has a memmap for the entire section. * * However, an ARM, and maybe other embedded architectures in the future * free memmap backing holes to save memory on the assumption the memmap is > > [...] > > > > > > You are trying to change a semantic of something that has a well defined > > > > meaning. I disagree that we should change it. It might sound like a > > > > simpler thing to do because pfn walkers will have to be checked but what > > > > you are proposing is conflating two different things together. > > > > > > I don't think that *I* try to change the semantic of pfn_valid(). > > > It would be original semantic of pfn_valid(). > > > > > > "If pfn_valid() returns true, we can get proper struct page and the > > > zone information," > > > > I do not see any guarantee about the zone information anywhere. In fact > > this is not true with the original implementation as I've tried to > > explain already. We do have new pages associated with a zone but that > > association might change during the online phase. So you cannot really > > rely on that information until the page is online. There is no real > > change in that regards after my rework. > > I know that what you did doesn't change thing much. What I try to say > is that previous implementation related to pfn_valid() in hotplug is > wrong. Please do not assume that hotplug implementation is correct and > other pfn_valid() users are incorrect. There is no design document so > I'm not sure which one is correct but assumption that pfn_valid() user > can access whole the struct page information makes much sense to me. Not really. E.g. ZONE_DEVICE pages are never online AFAIK. I believe we still need pfn_valid to work for those pfns. Really, pfn_valid has a different meaning than you would like it to have. Who knows how many others like that are lurking there. I feel much more comfortable to go and hunt already broken code and fix it rathert than break something unexpectedly. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| Date | 2017-04-27 04:10 +0200 |
| Message-ID | <tAH2x-2nz-5@gated-at.bofh.it> |
| In reply to | #1631315 |
On Wed, Apr 26, 2017 at 11:19:06AM +0200, Michal Hocko wrote: > > > [...] > > > > > > > > You are trying to change a semantic of something that has a well defined > > > > > meaning. I disagree that we should change it. It might sound like a > > > > > simpler thing to do because pfn walkers will have to be checked but what > > > > > you are proposing is conflating two different things together. > > > > > > > > I don't think that *I* try to change the semantic of pfn_valid(). > > > > It would be original semantic of pfn_valid(). > > > > > > > > "If pfn_valid() returns true, we can get proper struct page and the > > > > zone information," > > > > > > I do not see any guarantee about the zone information anywhere. In fact > > > this is not true with the original implementation as I've tried to > > > explain already. We do have new pages associated with a zone but that > > > association might change during the online phase. So you cannot really > > > rely on that information until the page is online. There is no real > > > change in that regards after my rework. > > > > I know that what you did doesn't change thing much. What I try to say > > is that previous implementation related to pfn_valid() in hotplug is > > wrong. Please do not assume that hotplug implementation is correct and > > other pfn_valid() users are incorrect. There is no design document so > > I'm not sure which one is correct but assumption that pfn_valid() user > > can access whole the struct page information makes much sense to me. > > Not really. E.g. ZONE_DEVICE pages are never online AFAIK. I believe we > still need pfn_valid to work for those pfns. Really, pfn_valid has a It's really contrary example to your insist. They requires not only struct page but also other information, especially, the zone index. They checks zone idx to know whether this page is for ZONE_DEVICE or not. So, pfn_valid() for ZONE_DEVICE pages assume that struct page has all the valid information. It's perfectly matched with my suggestion. Online isn't important issue here. What the important point is the condition that pfn_valid() return true. pfn_valid() for ZONE_DEVICE returns true after arch_add_memory() since all the struct page information is fixed there. If zone of hotplugged memory cannot be fixed at this moment, you can defef it until all the information is fixed (onlining). That seems to be better semantic of pfn_valid() to me. > different meaning than you would like it to have. Who knows how many > others like that are lurking there. I feel much more comfortable to go > and hunt already broken code and fix it rathert than break something > unexpectedly. I think that I did my best to explain my reasoning. It seems that we cannot agree with each other so it's better for some others to express their opinion to this problem. I will stop this discussion from now on. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-04-27 17:20 +0200 |
| Message-ID | <tATn5-2pt-33@gated-at.bofh.it> |
| In reply to | #1631828 |
On Thu 27-04-17 11:08:38, Joonsoo Kim wrote: > On Wed, Apr 26, 2017 at 11:19:06AM +0200, Michal Hocko wrote: > > > > [...] > > > > > > > > > > You are trying to change a semantic of something that has a well defined > > > > > > meaning. I disagree that we should change it. It might sound like a > > > > > > simpler thing to do because pfn walkers will have to be checked but what > > > > > > you are proposing is conflating two different things together. > > > > > > > > > > I don't think that *I* try to change the semantic of pfn_valid(). > > > > > It would be original semantic of pfn_valid(). > > > > > > > > > > "If pfn_valid() returns true, we can get proper struct page and the > > > > > zone information," > > > > > > > > I do not see any guarantee about the zone information anywhere. In fact > > > > this is not true with the original implementation as I've tried to > > > > explain already. We do have new pages associated with a zone but that > > > > association might change during the online phase. So you cannot really > > > > rely on that information until the page is online. There is no real > > > > change in that regards after my rework. > > > > > > I know that what you did doesn't change thing much. What I try to say > > > is that previous implementation related to pfn_valid() in hotplug is > > > wrong. Please do not assume that hotplug implementation is correct and > > > other pfn_valid() users are incorrect. There is no design document so > > > I'm not sure which one is correct but assumption that pfn_valid() user > > > can access whole the struct page information makes much sense to me. > > > > Not really. E.g. ZONE_DEVICE pages are never online AFAIK. I believe we > > still need pfn_valid to work for those pfns. Really, pfn_valid has a > > It's really contrary example to your insist. They requires not only > struct page but also other information, especially, the zone index. > They checks zone idx to know whether this page is for ZONE_DEVICE or not. Yes and they guarantee this association is true. Without memory onlining though. This memory is never online for anybody who is asking. [...] > I think that I did my best to explain my reasoning. It seems that we > cannot agree with each other so it's better for some others to express > their opinion to this problem. I will stop this discussion from now > on. I _do_ appreciate your feedback and if the general consensus is to modify pfn_valid I can go that direction but my gut feeling tells me that conflating "existing struct page" test and "fully online and initialized" one is a wrong thing to do. -- Michal Hocko SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web