NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/44969



The following reply was made to PR kern/44969; it has been noted by GNATS.

From: akachochin <bybinary01%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/44969
Date: Mon, 16 May 2011 23:00:47 +0900

 --0016e65b54fe1565ca04a3651501
 Content-Type: text/plain; charset=ISO-8859-1
 
 I'm Fumiyuki Yoshida.
 
 >Category:       kern
 > >Responsible:    kern-bug-people
 > >Synopsis:       vmem_xalloc() don't search best-fit free segment in spite
 > of VMEM_BESTFIT
 > >Arrival-Date:   Sun May 15 04:30:00 +0000 2011
 >
 
 Thank you for accepting my problem report.
 But I'm sorry for making a mistake about my patch in the report.I'll
 correect and re-submit it.
 Following is the patch I correct.
 
 --- subr_vmem.c 17 Dec 2010 22:24:11 -0000 1.58
 +++ subr_vmem.c 16 May 2011 13:57:06 -0000
 @@ -889,6 +889,7 @@
   bt_t *bt;
   bt_t *btnew;
   bt_t *btnew2;
 + bt_t *bestfit = NULL;
   const vmem_size_t size = vmem_roundup_size(vm, size0);
   vm_flag_t strat = flags & VM_FITMASK;
   vmem_addr_t start;
 @@ -943,12 +944,22 @@
   } else { /* VM_BESTFIT */
   for (list = first; list < end; list++) {
   LIST_FOREACH(bt, list, bt_freelist) {
 - if (bt->bt_size >= size) {
 - start = vmem_fit(bt, size, align, phase,
 -    nocross, minaddr, maxaddr);
 - if (start != VMEM_ADDR_NULL) {
 - goto gotit;
 - }
 + /* very best-fit */
 + if (bt->bt_size == size) {
 + bestfit = bt;
 + break;
 + }
 + else if( bestfit == NULL || (bestfit->size > bt->size) && ((bt->size -
 size > 0))){
 + bestfit = bt;
 + }
 + }
 +
 + if( bestfit ){
 + bt = bestfit;
 + start = vmem_fit(bt, size, align, phase,
 +    nocross, minaddr, maxaddr);
 + if (start != VMEM_ADDR_NULL) {
 + goto gotit;
   }
   }
   }
 
 --0016e65b54fe1565ca04a3651501
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 I&#39;m Fumiyuki Yoshida.<br><br><div class=3D"gmail_quote"><blockquote cla=
 ss=3D"gmail_quote" style=3D"margin:0pt 0pt 0pt 0.8ex;border-left:1px solid =
 rgb(204, 204, 204);padding-left:1ex">
 &gt;Category: =A0 =A0 =A0 kern<br>
 &gt;Responsible: =A0 =A0kern-bug-people<br>
 &gt;Synopsis: =A0 =A0 =A0 vmem_xalloc() don&#39;t search best-fit free segm=
 ent in spite of VMEM_BESTFIT<br>
 &gt;Arrival-Date: =A0 Sun May 15 04:30:00 +0000 2011<br></blockquote><div><=
 br>Thank you for accepting my problem report.<br>
 But I&#39;m sorry for making a mistake about my patch in the report.I&#39;l=
 l correect and re-submit it.</div><div>Following is the patch I correct.</d=
 iv><div><br></div><div><div>--- subr_vmem.c<span class=3D"Apple-tab-span" s=
 tyle=3D"white-space:pre">      </span>17 Dec 2010 22:24:11 -0000<span 
class=3D"A=
 pple-tab-span" style=3D"white-space:pre">      </span>1.58</div>
 <div>+++ subr_vmem.c<span class=3D"Apple-tab-span" style=3D"white-space:pre=
 ">     </span>16 May 2011 13:57:06 -0000</div><div>@@ -889,6 +889,7 
@@</div><di=
 v>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>bt_t =
 *bt;</div>
 <div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">      
</span>bt=
 _t *btnew;</div><div>=A0<span class=3D"Apple-tab-span" style=3D"white-space=
 :pre"> </span>bt_t *btnew2;</div><div>+<span class=3D"Apple-tab-span" style=
 =3D"white-space:pre">  </span>bt_t *bestfit =3D NULL;</div>
 <div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">      
</span>co=
 nst vmem_size_t size =3D vmem_roundup_size(vm, size0);</div><div>=A0<span c=
 lass=3D"Apple-tab-span" style=3D"white-space:pre">     </span>vm_flag_t strat =
 =3D flags &amp; VM_FITMASK;</div>
 <div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">      
</span>vm=
 em_addr_t start;</div><div>@@ -943,12 +944,22 @@</div><div>=A0<span class=
 =3D"Apple-tab-span" style=3D"white-space:pre"> </span>} else { /* VM_BESTFI=
 T */</div>
 <div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">              
</span>f=
 or (list =3D first; list &lt; end; list++) {</div><div>=A0<span class=3D"Ap=
 ple-tab-span" style=3D"white-space:pre">                       
</span>LIST_FOREACH(bt, list, bt=
 _freelist) {</div>
 <div>-<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                </span>i=
 f (bt-&gt;bt_size &gt;=3D size) {</div><div>-<span class=3D"Apple-tab-span"=
  style=3D"white-space:pre">                                    </span>start 
=3D vmem_fit(bt, size, align, =
 phase,</div>
 <div>-<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                        </span>=
  =A0 =A0nocross, minaddr, maxaddr);</div><div>-<span class=3D"Apple-tab-spa=
 n" style=3D"white-space:pre">                                  </span>if 
(start !=3D VMEM_ADDR_NULL) {</=
 div><div>-<span class=3D"Apple-tab-span" style=3D"white-space:pre">            
                                </=
 span>goto gotit;</div>
 <div>-<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                        </span>=
 }</div><div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">         
                <=
 /span>/* very best-fit */</div><div>+<span class=3D"Apple-tab-span" style=
 =3D"white-space:pre">                          </span>if (bt-&gt;bt_size 
=3D=3D size) {</div>
 <div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                        </span>=
 bestfit =3D bt;</div><div>+<span class=3D"Apple-tab-span" style=3D"white-sp=
 ace:pre">                                      </span>break;</div><div>+<span 
class=3D"Apple-tab-span" style=
 =3D"white-space:pre">                          </span>}</div>
 <div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                </span>e=
 lse if( bestfit =3D=3D NULL || (bestfit-&gt;size &gt; bt-&gt;size) &amp;&am=
 p; ((bt-&gt;size - size &gt; 0))){</div><div>+<span class=3D"Apple-tab-span=
 " style=3D"white-space:pre">                                   </span>bestfit 
=3D bt;</div>
 <div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                </span>}=
 </div><div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">          
        </s=
 pan>}</div><div>+</div><div>+<span class=3D"Apple-tab-span" style=3D"white-=
 space:pre">                    </span>if( bestfit ){</div>
 <div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                </span>b=
 t =3D bestfit;</div><div>+<span class=3D"Apple-tab-span" style=3D"white-spa=
 ce:pre">                               </span>start =3D vmem_fit(bt, size, 
align, phase,</div><div>+<s=
 pan class=3D"Apple-tab-span" style=3D"white-space:pre">                        
        </span> =A0 =A0n=
 ocross, minaddr, maxaddr);</div>
 <div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">                
                </span>i=
 f (start !=3D VMEM_ADDR_NULL) {</div><div>+<span class=3D"Apple-tab-span" s=
 tyle=3D"white-space:pre">                                      </span>goto 
gotit;</div><div>=A0<span class=
 =3D"Apple-tab-span" style=3D"white-space:pre">                         
</span>}</div>
 <div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">              
        </span>=
 }</div><div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">       
        <=
 /span>}</div><div><br></div><br>=A0<br></div></div><br>
 
 --0016e65b54fe1565ca04a3651501--
 


Home | Main Index | Thread Index | Old Index