On Thu, Jun 13, 2024 at 8:02 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com>
wrote:
On 2024/06/12 15:34, lijiang wrote:
> > --- a/memory.c
> > +++ b/memory.c
> > @@ -16075,6 +16075,8 @@ dump_swap_info(ulong swapflags, ulong
*totalswap_pages, ulong *totalused_pages)
> > char buf3[BUFSIZE];
> > char buf4[BUFSIZE];
> > char buf5[BUFSIZE];
> > + int swap_file_is_file =
> > + STREQ(MEMBER_TYPE_NAME("swap_info_struct",
"swap_file"), "file");
> >
> >
> > This patch looks good, but I still have one question:
> > The 'swap_file' has been added into the struct swap_info_struct
since linux v2.6.12-rc2,
> > and until now it(its type) has been never changed, it indicates
that the above checking is always true.
> >
> > STREQ(MEMBER_TYPE_NAME("swap_info_struct",
"swap_file"), "file")
> >
> > Is that expected behavior? Just want to confirm with you.
>
> Yes.
>
>
> Thank you for the confirmation, and explanation below, Kazu.
>
> As far as I checked, swap_file was changed from 'dentry *' to 'file
*'
> at somewhere between v2.4.0 and v2.6.0, so not always true.
>
> Seems no full history in linux github. I checked it from the linux
initial git repo:
>
> commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (tag: v2.6.12-rc2)
> Author: Linus Torvalds <torvalds(a)ppc970.osdl.org <mailto:
torvalds(a)ppc970.osdl.org>>
> Date: Sat Apr 16 15:20:36 2005 -0700
>
> Linux-2.6.12-rc2
>
> Initial git repository build. I'm not bothering with the full
history,
> even though we have it. We can create a separate "historical" git
> archive of that later if we want to, and in the meantime it's about
> 3.2GB when imported into git - space that would just make the early
> git days unnecessarily complicated, when we don't have a lot of good
> infrastructure for it.
>
> Let it rip!
>
>
> get_pathname()'s first arg is dentry, we have to choose the else-if
block
> without old_block_size, so I decided to use its type information
directly
>
> } else if
(VALID_MEMBER(swap_info_struct_old_block_size) ||
> swap_file_is_file) {
>
> The other if / else blocks are for very old kernels, so maybe they
won't
> be used, but if we don't remove these, I think this is a reasonable
way.
>
> Sounds good to me.
>
> Does this answer your question?
>
> Yes. Thank you, Kazu. I have no other issues. For the patch: Ack.
Good, thank you for your ack.
btw, I forgot to add the From: line below to the commit log, it would be
helpful if you would add this when merging:
From: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Ok, thanks for the info.
Lianbo
Thanks,
Kazu