Re: [PATCH 16/21] mm/shmem: Convert shmem_add_to_page_cache to take a folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 03, 2022 at 03:00:05PM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-05-03 13:48:50 [+0100], Matthew Wilcox wrote:
> > Thanks.  Stephen already reported that; fix here:
> > 
> > https://lore.kernel.org/all/Ym++SI1ftbRg+9zK@xxxxxxxxxxxxxxxxxxxx/
> 
> Stephen says "I applied the above patch to the mm tree merge today" and
> I have here next-20220503. I don't have the BUILD_BUG() in
> can_split_folio() anymore so I have this change.

Ah!  I didn't realise you were testing next; I thought you'd picked up
these patches some other way.

> My guess is that since THP_FILE_ALLOC is defined as BUILD_BUG() for
> !CONFIG_TRANSPARENT_HUGEPAGE and there is nothing that removes that part
> of the code, I end up in BUILD_BUG with CGROUP and no THP.
> 
> PageTransHuge() used to "return false" for !CONFIG_TRANSPARENT_HUGEPAGE
> which isn't the case for folio_test_large().

Indeed, indeed.  I missed another case.  This fixes it:

diff --git a/mm/shmem.c b/mm/shmem.c
index 5b161a92e6f1..019ad8bf0d21 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -716,7 +716,7 @@ static int shmem_add_to_page_cache(struct folio *folio,
 	if (!folio_test_swapcache(folio)) {
 		error = mem_cgroup_charge(folio, charge_mm, gfp);
 		if (error) {
-			if (folio_test_large(folio)) {
+			if (folio_test_pmd_mappable(folio)) {
 				count_vm_event(THP_FILE_FALLBACK);
 				count_vm_event(THP_FILE_FALLBACK_CHARGE);
 			}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux