From patchwork Fri Dec 13 22:24:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22405 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59B6A23FBA for ; Fri, 13 Dec 2013 22:27:14 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf8791427obc.5 for ; Fri, 13 Dec 2013 14:27:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=rOhFS9FoXmM8OPG8mrI2INbsyC96biQSG6GNZ7GKZrM=; b=OOWDrjOH4t8zx+OnEnJfaL2qtAwJX/a7MaJVFBW/Rch/ngRY1/Rytm2fDZfAyl1pJg 9berIwiZJpstDOd+V+e2+Ryr+iWuYAdGjnseyOaIKqW9mtJnV7dC5huVSoN0tC0BTmuY LxJy8lVKGaqpkpjqnQJEusydzf3fq3t9DvJR3qD4WIOp19xaYsSCdA1KaCin0PLSMVVt 82iy1jHI86AeQ69izx1aq1PK57+fvDLuBn697Jr+ldUNQhUIDeHJXofu2TY92RvEw56l JUdQgngK598gBT+r/x3+KCrxMFRTvGw7JVGgGIUJ6ByrchxW3cpvwrx4CGdhJXgUrMBW W8jA== X-Gm-Message-State: ALoCoQm40ZfigVJUA91buOEYR0GVRuB7yiCHXcjUqkoczm0hQVQBK4ogi9mrZL6NVpj/MTNWVJ6X X-Received: by 10.182.95.68 with SMTP id di4mr1962273obb.4.1386973633913; Fri, 13 Dec 2013 14:27:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.98 with SMTP id lj2ls1196087qeb.45.gmail; Fri, 13 Dec 2013 14:27:13 -0800 (PST) X-Received: by 10.58.168.205 with SMTP id zy13mr2177011veb.19.1386973633764; Fri, 13 Dec 2013 14:27:13 -0800 (PST) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id q19si1202509vea.25.2013.12.13.14.27.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id p5so1705358vbn.39 for ; Fri, 13 Dec 2013 14:27:13 -0800 (PST) X-Received: by 10.221.49.8 with SMTP id uy8mr1103753vcb.65.1386973633704; Fri, 13 Dec 2013 14:27:13 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp73521vcz; Fri, 13 Dec 2013 14:27:13 -0800 (PST) X-Received: by 10.66.66.234 with SMTP id i10mr5884539pat.127.1386973633044; Fri, 13 Dec 2013 14:27:13 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id wh6si2479154pac.306.2013.12.13.14.27.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kq14so595535pab.20 for ; Fri, 13 Dec 2013 14:27:12 -0800 (PST) X-Received: by 10.66.123.5 with SMTP id lw5mr5983858pab.83.1386973632036; Fri, 13 Dec 2013 14:27:12 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.27.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:09 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Rebecca Schultz Zavin , John Stultz Subject: [PATCH 040/115] gpu: ion: Fix lockdep issue in ion_page_pool Date: Fri, 13 Dec 2013 14:24:14 -0800 Message-Id: <1386973529-4884-41-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Rebecca Schultz Zavin Currently the mutex is held while kmalloc is called, under a low memory condition this might trigger the shrinker which also takes this mutex. Refactor so the mutex is not held during allocation. Signed-off-by: Rebecca Schultz Zavin [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz --- drivers/staging/android/ion/ion_page_pool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index ea45380..20790eb 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -53,6 +53,8 @@ static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page) item = kmalloc(sizeof(struct ion_page_pool_item), GFP_KERNEL); if (!item) return -ENOMEM; + + mutex_lock(&pool->mutex); item->page = page; if (PageHighMem(page)) { list_add_tail(&item->list, &pool->high_items); @@ -61,6 +63,7 @@ static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page) list_add_tail(&item->list, &pool->low_items); pool->low_count++; } + mutex_unlock(&pool->mutex); return 0; } @@ -110,9 +113,7 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct page* page) { int ret; - mutex_lock(&pool->mutex); ret = ion_page_pool_add(pool, page); - mutex_unlock(&pool->mutex); if (ret) ion_page_pool_free_pages(pool, page); }