Message ID | 20190619013856.11872-1-stuart.summers@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm: Use local variable for swap address space | expand |
On Tue, 18 Jun 2019, Stuart Summers <stuart.summers@intel.com> wrote: > This addresses the following build error: > mm/huge_memory.c: In function ‘__split_huge_page’: > mm/huge_memory.c:2506:41: warning: dereferencing ‘void *’ pointer > __xa_store(&swap_address_space(entry)->i_pages, > ^~ > mm/huge_memory.c:2506:41: error: request for member ‘i_pages’ in > something not a structure or union Did you check under what circumstances it would be a void pointer? Under those circumstances, what do you think will happen runtime after you've brushed the build error under the carpet? Anyway, the patch is against a commit in topic/core-for-CI, not to be merged elsewhere. BR, Jani. > > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Signed-off-by: Stuart Summers <stuart.summers@intel.com> > --- > mm/huge_memory.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index affb2c3667f9..bced5485137b 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2503,7 +2503,9 @@ static void __split_huge_page(struct page *page, struct list_head *list, > head + i, 0); > } else if (PageSwapCache(page)) { > swp_entry_t entry = { .val = page_private(head + i) }; > - __xa_store(&swap_address_space(entry)->i_pages, > + struct address_space *address_space = > + swap_address_space(entry); > + __xa_store(&address_space->i_pages, > swp_offset(entry), > head + i, 0); > }
On Wed, 2019-06-19 at 18:30 +0300, Jani Nikula wrote: > On Tue, 18 Jun 2019, Stuart Summers <stuart.summers@intel.com> wrote: > > This addresses the following build error: > > mm/huge_memory.c: In function ‘__split_huge_page’: > > mm/huge_memory.c:2506:41: warning: dereferencing ‘void *’ pointer > > __xa_store(&swap_address_space(entry)->i_pages, > > ^~ > > mm/huge_memory.c:2506:41: error: request for member ‘i_pages’ in > > something not a structure or union > > Did you check under what circumstances it would be a void pointer? This got things working, but I agree probably needs at least some basic checks here. I'll rework it. > > Under those circumstances, what do you think will happen runtime > after > you've brushed the build error under the carpet? > > Anyway, the patch is against a commit in topic/core-for-CI, not to be > merged elsewhere. Ok thanks for the feedback and makes sense. I'll resubmit. Thanks, Stuart > > BR, > Jani. > > > > > > > Cc: Chris Wilson <chris@chris-wilson.co.uk> > > Signed-off-by: Stuart Summers <stuart.summers@intel.com> > > --- > > mm/huge_memory.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index affb2c3667f9..bced5485137b 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -2503,7 +2503,9 @@ static void __split_huge_page(struct page > > *page, struct list_head *list, > > head + i, 0); > > } else if (PageSwapCache(page)) { > > swp_entry_t entry = { .val = page_private(head > > + i) }; > > - __xa_store(&swap_address_space(entry)->i_pages, > > + struct address_space *address_space = > > + swap_address_space(entry); > > + __xa_store(&address_space->i_pages, > > swp_offset(entry), > > head + i, 0); > > } > >
On Wed, 19 Jun 2019, "Summers, Stuart" <stuart.summers@intel.com> wrote: > On Wed, 2019-06-19 at 18:30 +0300, Jani Nikula wrote: >> On Tue, 18 Jun 2019, Stuart Summers <stuart.summers@intel.com> wrote: >> > This addresses the following build error: >> > mm/huge_memory.c: In function ‘__split_huge_page’: >> > mm/huge_memory.c:2506:41: warning: dereferencing ‘void *’ pointer >> > __xa_store(&swap_address_space(entry)->i_pages, >> > ^~ >> > mm/huge_memory.c:2506:41: error: request for member ‘i_pages’ in >> > something not a structure or union >> >> Did you check under what circumstances it would be a void pointer? > > This got things working, but I agree probably needs at least some basic > checks here. I'll rework it. Hint: CONFIG_SWAP. BR, Jani. > >> >> Under those circumstances, what do you think will happen runtime >> after >> you've brushed the build error under the carpet? >> >> Anyway, the patch is against a commit in topic/core-for-CI, not to be >> merged elsewhere. > > Ok thanks for the feedback and makes sense. I'll resubmit. > > Thanks, > Stuart > >> >> BR, >> Jani. >> >> >> >> > >> > Cc: Chris Wilson <chris@chris-wilson.co.uk> >> > Signed-off-by: Stuart Summers <stuart.summers@intel.com> >> > --- >> > mm/huge_memory.c | 4 +++- >> > 1 file changed, 3 insertions(+), 1 deletion(-) >> > >> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> > index affb2c3667f9..bced5485137b 100644 >> > --- a/mm/huge_memory.c >> > +++ b/mm/huge_memory.c >> > @@ -2503,7 +2503,9 @@ static void __split_huge_page(struct page >> > *page, struct list_head *list, >> > head + i, 0); >> > } else if (PageSwapCache(page)) { >> > swp_entry_t entry = { .val = page_private(head >> > + i) }; >> > - __xa_store(&swap_address_space(entry)->i_pages, >> > + struct address_space *address_space = >> > + swap_address_space(entry); >> > + __xa_store(&address_space->i_pages, >> > swp_offset(entry), >> > head + i, 0); >> > } >> >>
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index affb2c3667f9..bced5485137b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2503,7 +2503,9 @@ static void __split_huge_page(struct page *page, struct list_head *list, head + i, 0); } else if (PageSwapCache(page)) { swp_entry_t entry = { .val = page_private(head + i) }; - __xa_store(&swap_address_space(entry)->i_pages, + struct address_space *address_space = + swap_address_space(entry); + __xa_store(&address_space->i_pages, swp_offset(entry), head + i, 0); }
This addresses the following build error: mm/huge_memory.c: In function ‘__split_huge_page’: mm/huge_memory.c:2506:41: warning: dereferencing ‘void *’ pointer __xa_store(&swap_address_space(entry)->i_pages, ^~ mm/huge_memory.c:2506:41: error: request for member ‘i_pages’ in something not a structure or union Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Stuart Summers <stuart.summers@intel.com> --- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)