Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1269068ybi; Tue, 16 Jul 2019 12:13:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdQUTHaOGC/JmwhIqcgFm9bzqMWGGppnYsCgR+bjq3FpNFNHW1YFc4u9pL3kYMc2eOj+2r X-Received: by 2002:a17:902:102c:: with SMTP id b41mr37228791pla.204.1563304432031; Tue, 16 Jul 2019 12:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563304432; cv=none; d=google.com; s=arc-20160816; b=UBmaM4O7syigwAHOIMBw+kAy/5PdVBiB0bDOOFokA4ps5Dfp/ggh9212SZLsT5qT8E KYDpAhYX7JtQXACxcP+YyNKUfBAwtWnnp0mFh8LLi5A0Go9g1L/2xClt2Cp4sFqvrnOi 1uVAQgzCJpRVu0tkr/lwTL7sYxniQDOSR675SbrAbwhv3KXWO9HAglNgTNUA5OtuReXJ jeUcrCRa3px1UdKzQkww+m08UjiO/nB3HKitVuV6wNwTtq4J2e0zviD+nuizCkv2xB66 lWojNKhZZgRsAsnB5pXs+khwz/nCjWNwgSvjDytY2OKPkhF0AheBbsDMbyGtE9YCaUAZ 5bIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EokRdVtnqINNMeRei8g3SJejrlpwhuP/sBz4PdO769o=; b=Yd6Iz56tJu60fHViXz5eMjyr/nAIShD+5SzwVtjHbNXqotHfsVgJVqPayawnoW4tt+ EHgau//TWt6ZhJVGyt5Yuyh+GW+k1T3ZqonDFrnDsR5rrdWMOe3FcJ4FgwpeI3pQP64W O3jm974mHyd6pmiMf3+jMTIaRRXONaQErLBW59A5k5dNnhCyxgk77H4QIlnxmBoNONkI JxKpaIjXuyXaanqjQ3lQXIBAE2GC0bzf7X+XUpC9D0n/TTrUO+r7+dpUYFAMj+rrkHHv abhognvBJ8F5IVcgzJ5sko19gAoJk3hlG7X22VrzGBbP+CcbvAN1um8vk0bRUGbtHA3q BA4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kkXFYQ4B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si19483250pjp.24.2019.07.16.12.13.35; Tue, 16 Jul 2019 12:13:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kkXFYQ4B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728966AbfGPTM5 (ORCPT + 99 others); Tue, 16 Jul 2019 15:12:57 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:41025 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728137AbfGPTM5 (ORCPT ); Tue, 16 Jul 2019 15:12:57 -0400 Received: by mail-oi1-f196.google.com with SMTP id g7so16472409oia.8 for ; Tue, 16 Jul 2019 12:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EokRdVtnqINNMeRei8g3SJejrlpwhuP/sBz4PdO769o=; b=kkXFYQ4BGd2rPaOJss3nxEly+aTRCXPtLhXjo2jX0eHJ0gYk/NfDhYxZt2dbZDt7V/ Ht9777mnN/JK5uMBe+N50bVXOZEgNz70p1lOWFa86DgeLODas1wW/TEAgBZ+10rmXVg7 Wl/NA9vC9K+q6hvr5XobK72vptUqBgmytGGAd428TKu6DfFHTGZayCL78o9cxwCMcMZf KlCGJ1JfJ09UmfweNDAr/6G8rs5OsBrYixKRVgQE6fURLsnUsOOcZ3iNAIAdA6EnsXeL /QkLWj8uHiKK+O5D8RMtOmWM36Sm6GFsXhUA4HhPQWKV57lR6L3ki6Dt26//2+TGwB1i g6ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EokRdVtnqINNMeRei8g3SJejrlpwhuP/sBz4PdO769o=; b=KOz5RxwWkvXIBuKylTLMgf5DYObG3sZ5trWrmz1iF1Ek1ze6cV1Jun8OUV9tjJQqzN 4Xev09ie2CJkyJVWXrkwi/LPcJngvM96q+s6et5SAjPyob9enlMZIRRyl7LZFgJV7ahH 9ZcShz+5+hhlUpl3hMm0nbmtYlJGvZQ674Bna8XZ/JlEe5qnZh1WgNYM6nMAFvLdae5C UvXBt/XJDcXRKXxjQcj3TOfssCFiGi9WuVvk+MOt608z7ra8x1gN4N2Uk47++5WfL7GI u+GebFGPIkhMpAiY8eitGqBnoXYyU4fHgmyNer7YInW6VuXRC/DbMBLkS7MkD2s4Pm5x ySOw== X-Gm-Message-State: APjAAAWgooBpz0HcdnfFQ2Gro4tMZcGQ5F6VTU8cToP88PxQOAncVbVW mhR8xz8iYLPPl51cCdtbOx3z+6LcKoTKbYd7VHyCfw== X-Received: by 2002:aca:e641:: with SMTP id d62mr17288062oih.24.1563304376244; Tue, 16 Jul 2019 12:12:56 -0700 (PDT) MIME-Version: 1.0 References: <20190625213337.157525-1-saravanak@google.com> <20190625213337.157525-4-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Tue, 16 Jul 2019 12:12:20 -0700 Message-ID: Subject: Re: [PATCH v2 3/4] PM / devfreq: Cache OPP table reference in devfreq To: Sibi Sankar Cc: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" , Android Kernel Team , Linux PM , LKML , adharmap@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 16, 2019 at 10:36 AM Sibi Sankar wrote: > > Hey Saravana, > > On 6/26/19 3:03 AM, Saravana Kannan wrote: > > The OPP table can be used often in devfreq. Trying to get it each time can > > be expensive, so cache it in the devfreq struct. > > > > Signed-off-by: Saravana Kannan > > --- > > drivers/devfreq/devfreq.c | 6 ++++++ > > include/linux/devfreq.h | 1 + > > 2 files changed, 7 insertions(+) > > > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > > index 6b6991f0e873..ac62b78dc035 100644 > > --- a/drivers/devfreq/devfreq.c > > +++ b/drivers/devfreq/devfreq.c > > @@ -597,6 +597,8 @@ static void devfreq_dev_release(struct device *dev) > > if (devfreq->profile->exit) > > devfreq->profile->exit(devfreq->dev.parent); > > > > + if (devfreq->opp_table) > > + dev_pm_opp_put_opp_table(devfreq->opp_table); > > mutex_destroy(&devfreq->lock); > > kfree(devfreq); > > } > > @@ -677,6 +679,10 @@ struct devfreq *devfreq_add_device(struct device *dev, > > devfreq->max_freq = devfreq->scaling_max_freq; > > > > devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev); > > + devfreq->opp_table = dev_pm_opp_get_opp_table(dev); > > + if (IS_ERR(devfreq->opp_table)) > > + devfreq->opp_table = NULL; > > + > > atomic_set(&devfreq->suspend_count, 0); > > > > dev_set_name(&devfreq->dev, "devfreq%d", > > diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h > > index fbffa74bfc1b..0d877c9513d7 100644 > > --- a/include/linux/devfreq.h > > +++ b/include/linux/devfreq.h > > @@ -156,6 +156,7 @@ struct devfreq { > > struct devfreq_dev_profile *profile; > > const struct devfreq_governor *governor; > > char governor_name[DEVFREQ_NAME_LEN]; > > + struct opp_table *opp_table; > > please add it to the function docs as well Will do. -Saravana