Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934218AbcJRVBz (ORCPT ); Tue, 18 Oct 2016 17:01:55 -0400 Received: from smtprelay0194.hostedemail.com ([216.40.44.194]:34970 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933707AbcJRVBw (ORCPT ); Tue, 18 Oct 2016 17:01:52 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2553:2559:2562:2897:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3871:3872:3874:5007:6261:7875:9010:10004:10400:10848:10967:11026:11232:11658:11914:12043:12114:12438:12740:12760:13069:13311:13357:13439:14096:14097:14181:14659:14721:21080:30012:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: bike44_4a373c4d3f63f X-Filterd-Recvd-Size: 2295 Date: Tue, 18 Oct 2016 17:01:47 -0400 From: Steven Rostedt To: Christoph Hellwig Cc: akpm@linux-foundation.org, joelaf@google.com, jszhang@marvell.com, chris@chris-wilson.co.uk, joaodias@google.com, linux-mm@kvack.org, linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] mm: add preempt points into __purge_vmap_area_lazy Message-ID: <20161018170147.232aed1e@gandalf.local.home> In-Reply-To: <20161018205648.GB7021@home.goodmis.org> References: <1476773771-11470-1-git-send-email-hch@lst.de> <1476773771-11470-7-git-send-email-hch@lst.de> <20161018205648.GB7021@home.goodmis.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1209 Lines: 35 On Tue, 18 Oct 2016 16:56:48 -0400 Steven Rostedt wrote: > Is releasing the lock within a llist_for_each_entry_safe() actually safe? Is > vmap_area_lock the one to protect the valist? > > That is llist_for_each_entry_safe(va, n_va, valist, purg_list) does: > > for (va = llist_entry(valist, typeof(*va), purge_list); > &va->purge_list != NULL && > n_va = llist_entry(va->purge_list.next, typeof(*n_va), > purge_list, true); > pos = n) > > Thus n_va is pointing to the next element to process when we release the > lock. Is it possible for another task to get into this same path and process > the item that n_va is pointing to? Then when the preempted task comes back, > grabs the vmap_area_lock, and then continues the loop with what n_va has, > could that cause problems? That is, the next iteration after releasing the > lock does va = n_va. What happens if n_va no longer exits? > > I don't know this code that well, and perhaps vmap_area_lock is not protecting > the list and this is all fine. > Bah, nevermind. I missed the: valist = llist_del_all(&vmap_purge_list); so yeah, all should be good. Nothing to see here, move along please. -- Steve