Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751937AbbFMH07 (ORCPT ); Sat, 13 Jun 2015 03:26:59 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:37891 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963AbbFMH0v (ORCPT ); Sat, 13 Jun 2015 03:26:51 -0400 Date: Sat, 13 Jun 2015 09:26:35 +0200 From: Ingo Molnar To: Oleg Nesterov Cc: Linus Torvalds , Waiman Long , Thomas Gleixner , Denys Vlasenko , Borislav Petkov , Andrew Morton , Andy Lutomirski , linux-mml@vger.kernel.org, Linux Kernel Mailing List , Brian Gerst , "H. Peter Anvin" , Peter Zijlstra Subject: Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code Message-ID: <20150613072635.GA30388@gmail.com> References: <1434031637-9091-1-git-send-email-mingo@kernel.org> <1434031637-9091-8-git-send-email-mingo@kernel.org> <20150612072302.GA7509@gmail.com> <20150612080425.GC8759@gmail.com> <20150612203832.GA18966@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150612203832.GA18966@redhat.com> 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: 979 Lines: 37 * Oleg Nesterov wrote: > > So we could add tsk->mm_leader or so, > > No, no, please do not. Just do something like > > for_each_process(p) { > > for_each_thread(p, t) { So far that's what the for_each_process_thread() iterations I added do, right? > if (t->mm) { > do_something(t->mm); > break; > } > } > } > > But either way I don't understand what protects this ->mm. Perhaps this needs > find_lock_task_mm(). That's indeed a bug: I'll add task_lock()/unlock() before looking at ->mm. find_lock_task_mm() is not needed IMHO: we have a stable reference to 't', as a task can only go away via RCU expiry, and all the iterations I added are (supposed to) be RCU safe. 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/