Skip to contentSkip to conversation

Mapped pages handling in shrink_cache()

DISCUSSION [email protected] 2 participants 2 messages Dec 29, 2001

lore
Share & tools
lore
#0 lore raw

Hi, In the following code from shrink_cache()

          if (PageDirty(page) && is_page_cache_freeable(page) && page->mapping)
{
               .
               .
               .

               int (*writepage)(struct page *);

               writepage = page->mapping->a_ops->writepage;
               if ((gfp_mask & __GFP_FS) && writepage) {
                    ClearPageDirty(page);
                    SetPageLaunder(page);
                    page_cache_get(page);
                    spin_unlock(&pagemap_lru_lock);

                    writepage(page);
                    page_cache_release(page);

                    spin_lock(&pagemap_lru_lock);
                    continue;      <<<<<<< shouldn't the page be unlocked before
 continuing with the next page <<<<<
               }

I am reading 2.4.16

-- Amol

#1 lore raw
Quoted 18 lines · [email protected] wrote:

Hi, In the following code from shrink_cache()

          if (PageDirty(page) && is_page_cache_freeable(page) && page->mapping)
{
               .
               .
               .

               int (*writepage)(struct page *);

               writepage = page->mapping->a_ops->writepage;
               if ((gfp_mask & __GFP_FS) && writepage) {
                    ClearPageDirty(page);
                    SetPageLaunder(page);
                    page_cache_get(page);
                    spin_unlock(&pagemap_lru_lock);
Quoted 8 lines
                    writepage(page);
                    page_cache_release(page);

                    spin_lock(&pagemap_lru_lock);
                    continue;      <<<<<<< shouldn't the page be unlocked before
 continuing with the next page <<<<<
               }

The page is unlocked when IO completes, in interrupt context. See end_buffer_io_async().