Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754177AbbFNI0W (ORCPT ); Sun, 14 Jun 2015 04:26:22 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:33542 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbbFNI0J (ORCPT ); Sun, 14 Jun 2015 04:26:09 -0400 Date: Sun, 14 Jun 2015 10:26:03 +0200 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Andy Lutomirski , Andrew Morton , Denys Vlasenko , Brian Gerst , Peter Zijlstra , Borislav Petkov , "H. Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner , Waiman Long Subject: Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code Message-ID: <20150614082603.GA15048@gmail.com> References: <1434188955-31397-1-git-send-email-mingo@kernel.org> <1434188955-31397-8-git-send-email-mingo@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434188955-31397-8-git-send-email-mingo@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1322 Lines: 52 * Ingo Molnar wrote: > @@ -967,19 +979,32 @@ static void xen_pgd_unpin(struct mm_struct *mm) > */ > void xen_mm_unpin_all(void) > { > - struct page *page; > + struct task_struct *g, *p; > > - spin_lock(&pgd_lock); > + spin_lock(&pgd_lock); /* Implies rcu_read_lock() for the task list iteration: */ > > - list_for_each_entry(page, &pgd_list, lru) { > - if (PageSavePinned(page)) { > - BUG_ON(!PagePinned(page)); > - __xen_pgd_unpin(&init_mm, (pgd_t *)page_address(page)); > - ClearPageSavePinned(page); > + for_each_process_thread(g, p) { > + struct mm_struct *mm; > + struct page *page; > + pgd_t *pgd; > + > + task_lock(p); > + mm = p->mm; > + if (mm) { > + pgd = mm->pgd; > + page = virt_to_page(pgd); > + > + if (PageSavePinned(page)) { > + BUG_ON(!PagePinned(page)); > + __xen_pgd_unpin(&init_mm, pgd); > + ClearPageSavePinned(page); > + } > } > + task_unlock(p); > } > > spin_unlock(&pgd_lock); > + rcu_read_unlock(); > } I also removed the leftover stray rcu_read_unlock() from -v3. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/