From patchwork Wed Aug 19 17:25:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 508783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DA5B714032C for ; Thu, 20 Aug 2015 03:26:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=ILm+CJ3u; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=P+Cn y2LEcK9zN9/Qp5SYgf4L2fN7ji52Qf0HOv4c5+iG3DErm+zgCkQskKKsOrfb9gvS xfgvVShrTJh1TshnXLzieEM12s/PqH0OKXD7jAM6wOxoKEhpaGTnIVFBGUKZ3xYY ZRFx5/4QAbhZm43IdiZs1iDe2yLc3Vi3hZKGIi4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=jdbSiUkdrf rP6Lphlqbyfk4nvX4=; b=ILm+CJ3usU8H2bKA71Vzr0Mhxb6vOeiERHWzna5XNF G1vmslBsaKRhtwTF+/2F3iJFpak9AS9PbRwhdB84NTMAtMGlryXZ6NMhjxe8G5JK DWVSbozjFjCGC+24xX1wc59gNC4pVy/NH4WF+DbeljjXWxKOktBYkEFs9uDnug4D 0= Received: (qmail 35733 invoked by alias); 19 Aug 2015 17:25:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 35627 invoked by uid 89); 19 Aug 2015 17:25:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Date: Wed, 19 Aug 2015 22:55:49 +0530 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org, Josef Bacik Subject: [PATCH v2] Don't fall back to mmap if the original arena is not corrupt Message-ID: <20150819172549.GN2415@spoyarek.pnq.redhat.com> References: <1439974941-6577-1-git-send-email-siddhesh@redhat.com> <20150819135029.GC1584@vapier> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150819135029.GC1584@vapier> User-Agent: Mutt/1.5.23 (2014-03-12) On Wed, Aug 19, 2015 at 09:50:29AM -0400, Mike Frysinger wrote: > verified how ? Sorry, I meant to write "verified that there were no regressions on x86_64". Testing this behaviour itself is tricky since you'll need to generate the right amount of load to cause contention, with a single arena or in a retry path. > doesn't this comment explicitly say you don't want to use the avoid arena ? > doesn't it need updating now with this change in logic ? Right, updated patch with comment: Siddhesh diff --git a/malloc/arena.c b/malloc/arena.c index 21ecc5a1..2430d77 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -823,16 +823,20 @@ reused_arena (mstate avoid_arena) /* Make sure that the arena we get is not corrupted. */ mstate begin = result; + bool looped = false; + while (arena_is_corrupt (result) || result == avoid_arena) { result = result->next; if (result == begin) - break; + { + looped = true; + break; + } } - /* We could not find any arena that was either not corrupted or not the one - we wanted to avoid. */ - if (result == begin || result == avoid_arena) + /* We could not find any arena that was not corrupted. */ + if (looped) return NULL; /* No arena available without contention. Wait for the next in line. */