<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:01:30 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-6587] refactor OBD_ALLOC_LARGE to always do kmalloc first</title>
                <link>https://jira.whamcloud.com/browse/LU-6587</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Since vmalloc allocations are notoriously unscalable and slow, we should do what other filesystems are doing (and what we converted upstream kernel client to do) and for large allocations we should always try kmalloc first (with NOWARN flag) and then if that fails, retry with vmalloc.&lt;/p&gt;</description>
                <environment></environment>
        <key id="30011">LU-6587</key>
            <summary>refactor OBD_ALLOC_LARGE to always do kmalloc first</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="ys">Yang Sheng</assignee>
                                    <reporter username="green">Oleg Drokin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 11 May 2015 12:07:35 +0000</created>
                <updated>Fri, 5 Feb 2016 15:35:17 +0000</updated>
                            <resolved>Fri, 5 Feb 2016 15:35:17 +0000</resolved>
                                                    <fixVersion>Lustre 2.8.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>14</watches>
                                                                            <comments>
                            <comment id="116639" author="yujian" created="Thu, 28 May 2015 06:44:57 +0000"  >&lt;p&gt;Yang Sheng is creating the patch and will push it to Gerrit.&lt;/p&gt;</comment>
                            <comment id="116659" author="gerrit" created="Thu, 28 May 2015 11:25:05 +0000"  >&lt;p&gt;Yang Sheng (yang.sheng@intel.com) uploaded a new patch: &lt;a href=&quot;http://review.whamcloud.com/14994&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/14994&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6587&quot; title=&quot;refactor OBD_ALLOC_LARGE to always do kmalloc first&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6587&quot;&gt;&lt;del&gt;LU-6587&lt;/del&gt;&lt;/a&gt; obd: refactor OBD_ALLOC_LARGE marco&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: a72771fc367cb430626bb6bf885fabb7a4cd945e&lt;/p&gt;</comment>
                            <comment id="119420" author="gerrit" created="Wed, 24 Jun 2015 02:23:48 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/14994/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/14994/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6587&quot; title=&quot;refactor OBD_ALLOC_LARGE to always do kmalloc first&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6587&quot;&gt;&lt;del&gt;LU-6587&lt;/del&gt;&lt;/a&gt; mem: refactor OBD_ALLOC_LARGE marco&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 919b85d796f845ec3e6633702dda1639a3d86176&lt;/p&gt;</comment>
                            <comment id="119425" author="ys" created="Wed, 24 Jun 2015 05:48:55 +0000"  >&lt;p&gt;The next step of this ticket is replacing OBD_FREE_LARGE to OBD_FREE. Either all in one or one by one as subsystem.  But i think we need a grace period for every one know that. So could we close this ticket first?&lt;/p&gt;</comment>
                            <comment id="119441" author="simmonsja" created="Wed, 24 Jun 2015 13:08:44 +0000"  >&lt;p&gt;Looking at patches by their sublayer the areas under going the most changes are llite, osp, and target. I would recommend doing a patch set with that combination that could perhaps be landed after feature freeze. The rest of the OBD_FREE_LARGE users appear to be safe to update. I noticed ptlrpc and obdclass are large users of OBD_FREE_LARGE so if you might wanted to do a patch set covering those regions.&lt;/p&gt;</comment>
                            <comment id="119567" author="ys" created="Thu, 25 Jun 2015 02:50:44 +0000"  >&lt;p&gt;Thanks for your comment, James. I think it is good idea to make a patch against stable code first.&lt;/p&gt;</comment>
                            <comment id="134313" author="pjones" created="Mon, 23 Nov 2015 22:44:26 +0000"  >&lt;p&gt;It looks like this is landed for 2.8&lt;/p&gt;</comment>
                            <comment id="139005" author="adilger" created="Fri, 15 Jan 2016 03:41:35 +0000"  >&lt;p&gt;I noticed that there was something landed in the &lt;a href=&quot;http://review.whamcloud.com/14994&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/14994&lt;/a&gt; patch that I don&apos;t really like.  Moving &lt;tt&gt;is_vmalloc_addr()&lt;/tt&gt; into OBD_FREE() means that there is the overhead of this check for every call to OBD_FREE(), even though this is not needed for the large majority of allocations.  It would be better to have the &lt;tt&gt;is_vmalloc_addr()&lt;/tt&gt; check only in OBD_FREE_LARGE() and remove it from OBD_FREE().  The deprecation of OBD_FREE_LARGE() should also be removed from checkpatch.pl.&lt;/p&gt;

&lt;p&gt;There are a couple of patches that have landed since then that need to be converted back to using OBD_FREE_LARGE(), at least:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;af13cfff297d4882de35fb7c11bf5261293b8287
09141c0796802e7a3471c084ea5928674b3a1862
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="139006" author="adilger" created="Fri, 15 Jan 2016 03:42:37 +0000"  >&lt;p&gt;Since this is only a few lines of change, it would be good to get this fixed before 2.9 if possible.&lt;/p&gt;</comment>
                            <comment id="139202" author="gerrit" created="Mon, 18 Jan 2016 20:00:35 +0000"  >&lt;p&gt;Andreas Dilger (andreas.dilger@intel.com) uploaded a new patch: &lt;a href=&quot;http://review.whamcloud.com/18034&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/18034&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6587&quot; title=&quot;refactor OBD_ALLOC_LARGE to always do kmalloc first&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6587&quot;&gt;&lt;del&gt;LU-6587&lt;/del&gt;&lt;/a&gt; obdclass: use OBD_FREE_LARGE with OBD_ALLOC_LARGE&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: a7ac09582c72dad0be99db2072971dd34d6d6165&lt;/p&gt;</comment>
                            <comment id="139489" author="green" created="Wed, 20 Jan 2016 19:52:19 +0000"  >&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; inline &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; is_vmalloc_addr(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; void *x)
{
#ifdef CONFIG_MMU
        unsigned &lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt; addr = (unsigned &lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt;)x;

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; addr &amp;gt;= VMALLOC_START &amp;amp;&amp;amp; addr &amp;lt; VMALLOC_END;
#&lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 0;
#endif
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So I believe there&apos;s next to no overhead in is_vmalloc_addr esp. compared to other stuff we do in OBD_FREE()&lt;/p&gt;

&lt;p&gt;I&apos;d be instead inclined to drop OBD_ALLOC_LARGE and just always do OBD_ALLOC that would fallbacl to vmalloc if regular alloc failed?&lt;/p&gt;</comment>
                            <comment id="139502" author="adilger" created="Wed, 20 Jan 2016 21:32:01 +0000"  >&lt;p&gt;Sure there is little overhead to check &lt;tt&gt;is_vmalloc_addr()&lt;/tt&gt; for every single allocation, but not zero, so why would we use it everywhere when it is not needed. Also, in the upstream kernel these macros are gone and we don&apos;t want to have the &lt;tt&gt;vmalloc((&lt;/tt&gt; fallback and calls to &lt;tt&gt;is_vmalloc_addr()&lt;/tt&gt; check &lt;em&gt;everywhere&lt;/em&gt; in the code simply because we don&apos;t know anymore which allocations might be large and which ones are not. We&apos;d be taking a huge step backwards in terms of code quality, and a patch like that would never be accepted upstream, so why would we do it in master just because it can hide inside a macro?&lt;/p&gt;

&lt;p&gt;Having huge allocations that require vmalloc() is something we should be very aware of and make a conscious decision to do, as otherwise we might be wasting a lot of memory accidentally.&lt;/p&gt;</comment>
                            <comment id="139529" author="simmonsja" created="Thu, 21 Jan 2016 01:55:58 +0000"  >&lt;p&gt;Doesn&apos;t OBD_ALLOC_LARGE always try a kmalloc first then if it fails try a vmalloc? I don&apos;t think we can just drop the is_vmalloc_addr so easily. I agree with you Andreas that the vmalloc fallbacks are bad news but instead of trying to modify OBD_FREE_LARGE why don&apos;t we ripe off the band aid and start using vmalloc directly when it really needed. Note the upstream client has function wrapper libcfs_kvzalloc()  and libcfs_kvzalloc_cpt() in libcfs to replace all those macros. Honestly I like to just use vmalloc directly.&lt;/p&gt;</comment>
                            <comment id="139531" author="green" created="Thu, 21 Jan 2016 02:35:16 +0000"  >&lt;p&gt;James: The problem with vmalloc is that it is expensive, it&apos;s all done under a single lock for one.&lt;br/&gt;
As such trying kmalloc first has a big advantage of speed should there be big enough chunk of memory really available.&lt;/p&gt;

&lt;p&gt;Andreas: You are right that the overhead is there, even though it is pretty much negligible and for as long as we retain OBD_ALLOC_LARGE/FREE it makes the most sense to have the check in there and not in the OBD_ALLOC/FREE&lt;/p&gt;</comment>
                            <comment id="139532" author="adilger" created="Thu, 21 Jan 2016 03:31:15 +0000"  >&lt;p&gt;James, I&apos;d be happy to use the libcfs_kvzalloc() and libcfs_kbfree() in master as well. We definitely can&apos;t use vmalloc() for everything in Lustre, since the performance penalty would be very high as Oleg wrote. Those helpers should still be wrapped as OBD_ALLOC_LARGE() and OBD_FREE_LARGE() to account memory allocations so that we can find memory leaks in the code. In either case, we still need to know that &quot;large&quot; allocations need to be freed differently from normal ones. &lt;/p&gt;</comment>
                            <comment id="139567" author="simmonsja" created="Thu, 21 Jan 2016 15:38:49 +0000"  >&lt;p&gt;Sorry I wasn&apos;t completely clear at what I was purposing. I was considering the idea of dropping vmalloc usage completely unless the allocation is more than 4MB. It was only those cases I would consider looking at vmalloc usage directly. Sorry for the confusion.&lt;/p&gt;

&lt;p&gt;As for memory accounting that is a separate topic for 2.9 but it is a good topic. We really should look at more standard ways to detect kernel leaks which are far more powerful than what lustre does today. I will open a separate ticket for that.&lt;/p&gt;</comment>
                            <comment id="141345" author="gerrit" created="Fri, 5 Feb 2016 15:07:04 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/18034/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/18034/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6587&quot; title=&quot;refactor OBD_ALLOC_LARGE to always do kmalloc first&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6587&quot;&gt;&lt;del&gt;LU-6587&lt;/del&gt;&lt;/a&gt; obdclass: use OBD_FREE_LARGE with OBD_ALLOC_LARGE&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 0b1ad400c8f64575292a7ff54a8ce872a124b19e&lt;/p&gt;</comment>
                            <comment id="141357" author="jgmitter" created="Fri, 5 Feb 2016 15:35:17 +0000"  >&lt;p&gt;Patch has landed for 2.8&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="34114">LU-7666</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzxcxb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>