@@ -258,54 +258,9 @@ static inline bool folio_try_get(struct folio *folio)
258258 return folio_ref_add_unless (folio , 1 , 0 );
259259}
260260
261- static inline bool folio_ref_try_add_rcu (struct folio * folio , int count )
262- {
263- #ifdef CONFIG_TINY_RCU
264- /*
265- * The caller guarantees the folio will not be freed from interrupt
266- * context, so (on !SMP) we only need preemption to be disabled
267- * and TINY_RCU does that for us.
268- */
269- # ifdef CONFIG_PREEMPT_COUNT
270- VM_BUG_ON (!in_atomic () && !irqs_disabled ());
271- # endif
272- VM_BUG_ON_FOLIO (folio_ref_count (folio ) == 0 , folio );
273- folio_ref_add (folio , count );
274- #else
275- if (unlikely (!folio_ref_add_unless (folio , count , 0 ))) {
276- /* Either the folio has been freed, or will be freed. */
277- return false;
278- }
279- #endif
280- return true;
281- }
282-
283- /**
284- * folio_try_get_rcu - Attempt to increase the refcount on a folio.
285- * @folio: The folio.
286- *
287- * This is a version of folio_try_get() optimised for non-SMP kernels.
288- * If you are still holding the rcu_read_lock() after looking up the
289- * page and know that the page cannot have its refcount decreased to
290- * zero in interrupt context, you can use this instead of folio_try_get().
291- *
292- * Example users include get_user_pages_fast() (as pages are not unmapped
293- * from interrupt context) and the page cache lookups (as pages are not
294- * truncated from interrupt context). We also know that pages are not
295- * frozen in interrupt context for the purposes of splitting or migration.
296- *
297- * You can also use this function if you're holding a lock that prevents
298- * pages being frozen & removed; eg the i_pages lock for the page cache
299- * or the mmap_lock or page table lock for page tables. In this case,
300- * it will always succeed, and you could have used a plain folio_get(),
301- * but it's sometimes more convenient to have a common function called
302- * from both locked and RCU-protected contexts.
303- *
304- * Return: True if the reference count was successfully incremented.
305- */
306- static inline bool folio_try_get_rcu (struct folio * folio )
261+ static inline bool folio_ref_try_add (struct folio * folio , int count )
307262{
308- return folio_ref_try_add_rcu (folio , 1 );
263+ return folio_ref_add_unless (folio , count , 0 );
309264}
310265
311266static inline int page_ref_freeze (struct page * page , int count )
0 commit comments