From: David Hildenbrand <david@redhat.com>
To: Yang Shi <shy828301@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
Peter Xu <peterx@redhat.com>, Hugh Dickins <hughd@google.com>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH v2] mm/swap: fix SWP_PFN_BITS with CONFIG_PHYS_ADDR_T_64BIT on 32bit
Date: Thu, 8 Dec 2022 09:41:43 +0100 [thread overview]
Message-ID: <bc50265a-d657-c23b-9cfd-3928f3324906@redhat.com> (raw)
In-Reply-To: <CAHbLzkra0mjn4utzYPNp+-e77W3tb6yJiJMhkK9Kg=Ra_3rQnQ@mail.gmail.com>
On 07.12.22 23:40, Yang Shi wrote:
> On Tue, Dec 6, 2022 at 2:57 AM David Hildenbrand <david@redhat.com> wrote:
>>
>> We use "unsigned long" to store a PFN in the kernel and phys_addr_t to
>> store a physical address.
>>
>> On a 64bit system, both are 64bit wide. However, on a 32bit system, the
>> latter might be 64bit wide. This is, for example, the case on x86 with
>> PAE: phys_addr_t and PTEs are 64bit wide, while "unsigned long" only
>> spans 32bit.
>>
>> The current definition of SWP_PFN_BITS without MAX_PHYSMEM_BITS misses
>> that case, and assumes that the maximum PFN is limited by an 32bit
>> phys_addr_t. This implies, that SWP_PFN_BITS will currently only be able to
>> cover 4 GiB - 1 on any 32bit system with 4k page size, which is wrong.
>
> Thanks for debugging this. IIUC this means even swap is actually
> broken on x86_32 + PAE?
I saw all different kinds of issues while testing debugging without this
patch, but they might just be a fallout from previous page migration/THP
splitting issues.
I think swap should be fine, because SWP_PFN_BITS only affects
swp_offset_pfn(): only used when is_pfn_swap_entry()==true.
Thanks!
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2022-12-08 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 10:57 [PATCH v2] mm/swap: fix SWP_PFN_BITS with CONFIG_PHYS_ADDR_T_64BIT on 32bit David Hildenbrand
2022-12-06 22:12 ` Peter Xu
2022-12-07 21:18 ` David Hildenbrand
2022-12-07 22:40 ` Yang Shi
2022-12-08 8:41 ` David Hildenbrand [this message]
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=bc50265a-d657-c23b-9cfd-3928f3324906@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=shy828301@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).