@@ -428,17 +428,17 @@ bool workingset_test_recent(void *shadow, bool file, bool *workingset,
428
428
struct pglist_data * pgdat ;
429
429
unsigned long eviction ;
430
430
431
- rcu_read_lock ();
432
-
433
431
if (lru_gen_enabled ()) {
434
- bool recent = lru_gen_test_recent (shadow , file ,
435
- & eviction_lruvec , & eviction , workingset );
432
+ bool recent ;
436
433
434
+ rcu_read_lock ();
435
+ recent = lru_gen_test_recent (shadow , file , & eviction_lruvec ,
436
+ & eviction , workingset );
437
437
rcu_read_unlock ();
438
438
return recent ;
439
439
}
440
440
441
-
441
+ rcu_read_lock ();
442
442
unpack_shadow (shadow , & memcgid , & pgdat , & eviction , workingset );
443
443
eviction <<= bucket_order ;
444
444
@@ -459,14 +459,12 @@ bool workingset_test_recent(void *shadow, bool file, bool *workingset,
459
459
* configurations instead.
460
460
*/
461
461
eviction_memcg = mem_cgroup_from_id (memcgid );
462
- if (!mem_cgroup_disabled () &&
463
- (!eviction_memcg || !mem_cgroup_tryget (eviction_memcg ))) {
464
- rcu_read_unlock ();
465
- return false;
466
- }
467
-
462
+ if (!mem_cgroup_tryget (eviction_memcg ))
463
+ eviction_memcg = NULL ;
468
464
rcu_read_unlock ();
469
465
466
+ if (!mem_cgroup_disabled () && !eviction_memcg )
467
+ return false;
470
468
/*
471
469
* Flush stats (and potentially sleep) outside the RCU read section.
472
470
*
@@ -544,6 +542,8 @@ void workingset_refault(struct folio *folio, void *shadow)
544
542
bool workingset ;
545
543
long nr ;
546
544
545
+ VM_BUG_ON_FOLIO (!folio_test_locked (folio ), folio );
546
+
547
547
if (lru_gen_enabled ()) {
548
548
lru_gen_refault (folio , shadow );
549
549
return ;
@@ -558,7 +558,6 @@ void workingset_refault(struct folio *folio, void *shadow)
558
558
* is actually experiencing the refault event. Make sure the folio is
559
559
* locked to guarantee folio_memcg() stability throughout.
560
560
*/
561
- VM_BUG_ON_FOLIO (!folio_test_locked (folio ), folio );
562
561
nr = folio_nr_pages (folio );
563
562
memcg = folio_memcg (folio );
564
563
pgdat = folio_pgdat (folio );
0 commit comments